[New-bugs-announce] [issue21009] Potential deadlock in concurrent futures when garbage collection occurs during Queue.get

Simon Jagoe report at bugs.python.org
Fri Mar 21 16:47:26 CET 2014


New submission from Simon Jagoe:

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.

----------
components: Library (Lib)
files: executor-hang.py
messages: 214380
nosy: simon.jagoe
priority: normal
severity: normal
status: open
title: Potential deadlock in concurrent futures when garbage collection occurs during Queue.get
type: behavior
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file34551/executor-hang.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21009>
_______________________________________


More information about the New-bugs-announce mailing list