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 sbt
Recipients Giovanni.Bajo, avian, bobbyi, gregory.p.smith, jcea, lesha, neologix, nirai, pitrou, sbt, sdaoden, vinay.sajip, vstinner
Date 2012-06-01.06:58:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1338533939.6.0.779827783959.issue6721@psf.upfronthosting.co.za>
In-reply-to
Content
> conn = MySQLConn() > start_thread1(conn) > start_thread2(conn): > while True: > if os.fork() == 0: # child > raise Exception('doom') # triggers destructor There is no guarantee here that the lock will be held at the time of the fork. So even if we ensure that a lock acquired before the fork stayed lock, we won't necessarily get a deadlock. More importantly, you should never fork without ensuring that you exit with os._exit() or os.exec*(). So your example should be something like conn = MySQLConn() start_thread1(conn) start_thread2(conn): while True: if os.fork() == 0: # child try: raise Exception('doom') # does NOT trigger destructor except: sys.excepthook(*sys.exc_info()) os._exit(1) else: os._exit(0) With this hard exit the destructor never runs.
History
Date User Action Args
2012-06-01 06:58:59sbtsetrecipients: + sbt, gregory.p.smith, vinay.sajip, jcea, pitrou, vstinner, nirai, bobbyi, neologix, Giovanni.Bajo, sdaoden, avian, lesha
2012-06-01 06:58:59sbtsetmessageid: <1338533939.6.0.779827783959.issue6721@psf.upfronthosting.co.za>
2012-06-01 06:58:59sbtlinkissue6721 messages
2012-06-01 06:58:58sbtcreate