Message 214380 - Python tracker

Message214380

Author simon.jagoe
Recipients simon.jagoe
Date 2014-03-21.15:47:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1395416846.85.0.759574712799.issue21009@psf.upfronthosting.co.za>
In-reply-to
Content
At Enthought we have been tracking a deadlock in some code that turned out to be due to the following scenario:

  0) There is some cyclic garbage that requires collection; an object in the garbage is referred to by a weakref with a callback
  1) You have a lock that is acquired
  2) While the lock is held, the garbage collector runs (on the same thread)
  3) The weakref callback in (0) is called via the garbage collecter and the callback tries to acquire the same lock that was acquired in (1)

Attached is a simple script that exercises the issue in Python 3.3. The script monkey-patches Queue.get to force garbage collection after acquiring the Queue.not_empty lock.
History
Date User Action Args
2014-03-21 15:47:26simon.jagoesetrecipients: + simon.jagoe
2014-03-21 15:47:26simon.jagoesetmessageid: <1395416846.85.0.759574712799.issue21009@psf.upfronthosting.co.za>
2014-03-21 15:47:26simon.jagoelinkissue21009 messages
2014-03-21 15:47:26simon.jagoecreate