Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8694605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:49:23+00:00 2026-06-13T00:49:23+00:00

The OS will not like it if you use multiprocessing and accidentally end up

  • 0

The OS will not like it if you use multiprocessing and accidentally end up creating processes without limit.

Is there any simple solution that prevents this from happening (say, by limiting total number of processes, either in Python or in the OS)?

I use Windows, and it behaves really badly (requires hard reboot) when I make a mistake like that. So I’d love it if there’s some code that I can wrap around / add to my application and prevent this from happening.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:49:25+00:00Added an answer on June 13, 2026 at 12:49 am

    What you can do is create a short ‘trip-wire’ type module and import it as well as multiprocessing. The trip-wire module will raise an exception if it detects a multiprocessing infinite loop.

    Mine looks like this:

    #mp_guard.py
    """tracks invocation by creating an environment variable; if that
    variable exists when next called a loop is in progress"""
    
    import os
    
    class Brick(Exception):
        def __init__(self):
            Exception.__init__(self, "Your machine just narrowly avoided becoming"
                                     " a brick!")
    
    if 'MP_GUARD' in os.environ:
        raise Brick
    
    os.environ['MP_GUARD'] = 'active'
    

    And in the main .py file:

    import mp_guard
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to have a commit message cleanup that will not necessarily remove lines
Would like to make anapplication in Java that will not automatically parse parameters used
I've found that the Like Box app for Facebook will not recognise certain pages
I have a facebook like button on http://www.hotsear.ch , but will not show a
Why something like following is not allowed. I mean why the following method will
Usually it will ignore C files that are not documented, but I'd like to
By default it will not print out anything until the whole page has finished
My host will not allow me to change the default folder of my primary
I do not understand why the dialog will not work for width in Firefox
The following example will not compile for me: #include <iostream> #include <functional> #include <string>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.