This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author aonishuk
Recipients aonishuk
Date 2016-07-04.12:52:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1467636752.08.0.502936379731.issue27448@psf.upfronthosting.co.za>
In-reply-to
Content
We had problem where at some point python start consuming RAM. Until it ends.

The reason was race condition in subprocess.Popen. Which triggered gc.disable() and never gc.enable().

The workaround we use is:
subprocess.gc.isenabled = lambda: True


The scenario for race condition is pretty obvious looking into the code below:

          gc_was_enabled = gc.isenabled() <- T1 gets false here
          gc.disable()
          try:
              self.pid = os.fork() <- while T2 is here
          except:
              if gc_was_enabled:
                  gc.enable()
              raise
          ... CODE FRAGMENT 1 ...
          if gc_was_enabled:
              gc.enable()

Also I wonder if exception fails in "... CODE FRAGMENT 1 ..." why don't we re-enable gc (finally block)
History
Date User Action Args
2016-07-04 12:52:32aonishuksetrecipients: + aonishuk
2016-07-04 12:52:32aonishuksetmessageid: <1467636752.08.0.502936379731.issue27448@psf.upfronthosting.co.za>
2016-07-04 12:52:32aonishuklinkissue27448 messages
2016-07-04 12:52:31aonishukcreate