Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue7264] test_threading_local sometimes hangs when run with -R

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Nov 4, 2009, 12:04 PM

Post #1 of 10 (346 views)
Permalink
[issue7264] test_threading_local sometimes hangs when run with -R

New submission from Antoine Pitrou <pitrou [at] free>:

If I run something like:
./python -m test.regrtest -R3:2: test_threading_local

Python sometimes hangs and I have to "kill -9" it.

Running through gdb shows it gets stuck at the following point:

/home/antoine/cpython/debug/Lib/threading.py (239): wait
/home/antoine/cpython/debug/Lib/threading.py (638): join
/home/antoine/cpython/debug/Lib/test/test_threading_local.py (68):
test_derived
[snip]

That is, it hangs waiting for a thread to join().

----------
components: Library (Lib), Tests
messages: 94900
nosy: gps, pitrou
priority: normal
severity: normal
status: open
title: test_threading_local sometimes hangs when run with -R
type: crash
versions: Python 2.7

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7264>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 4, 2009, 12:23 PM

Post #2 of 10 (318 views)
Permalink
[issue7264] test_threading_local sometimes hangs when run with -R [In reply to]

Antoine Pitrou <pitrou [at] free> added the comment:

It turns out that the __del__ method in _threading_local.py tries to
call threading.enumerate() which itself takes the _active_limbo_lock.
The problem is that __del__ can be called at any point in time (because
of the GC), including at a point where the same thread has already taken
the lock. The obvious fix is to bypass enumerate().

(an alternate fix would be to use an RLock for _active_limbo_lock, but
it could have unforeseen consequences, such as performance ones)

----------
keywords: +patch
Added file: http://bugs.python.org/file15259/threading_local.patch

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7264>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 4, 2009, 12:23 PM

Post #3 of 10 (315 views)
Permalink
[issue7264] test_threading_local sometimes hangs when run with -R [In reply to]

Changes by Antoine Pitrou <pitrou [at] free>:


----------
stage: -> patch review

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7264>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 4, 2009, 12:24 PM

Post #4 of 10 (315 views)
Permalink
[issue7264] test_threading_local sometimes hangs when run with -R [In reply to]

Changes by Antoine Pitrou <pitrou [at] free>:


----------
versions: +Python 2.6, Python 3.1, Python 3.2

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7264>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 4, 2009, 3:19 PM

Post #5 of 10 (312 views)
Permalink
[issue7264] test_threading_local sometimes hangs when run with -R [In reply to]

Gregory P. Smith <greg [at] krypto> added the comment:

How about defining this in threading.py:

def _enumerate():
"""Internal use only: enumerate() without the lock."""
return _active.values() + _limbo.values()

And calling it from _threading_local instead of accessing _active and
_limbo directly.

----------
nosy: +gregory.p.smith

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7264>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 4, 2009, 3:24 PM

Post #6 of 10 (323 views)
Permalink
[issue7264] test_threading_local sometimes hangs when run with -R [In reply to]

Antoine Pitrou <pitrou [at] free> added the comment:

Good point. Here is a new patch.

----------
Added file: http://bugs.python.org/file15264/threading_local2.patch

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7264>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 4, 2009, 10:32 PM

Post #7 of 10 (313 views)
Permalink
[issue7264] test_threading_local sometimes hangs when run with -R [In reply to]

Gregory P. Smith <greg [at] krypto> added the comment:

Looks good to me.

typed poorly on a tiny Android phone.

On Nov 4, 2009 3:24 PM, "Antoine Pitrou" <report [at] bugs> wrote:

Antoine Pitrou <pitrou [at] free> added the comment:

Good point. Here is a new patch.

----------
Added file: http://bugs.python.org/file15264/threading_local2.patch

_______________________________________ Python tracker <
report [at] bugs> <http://bugs.python...

----------
Added file: http://bugs.python.org/file15266/unnamed

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7264>
_______________________________________
Attachments: unnamed (0.78 KB)


report at bugs

Nov 5, 2009, 5:38 AM

Post #8 of 10 (305 views)
Permalink
[issue7264] test_threading_local sometimes hangs when run with -R [In reply to]

Changes by Antoine Pitrou <pitrou [at] free>:


Removed file: http://bugs.python.org/file15266/unnamed

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7264>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 5, 2009, 6:42 AM

Post #9 of 10 (303 views)
Permalink
[issue7264] test_threading_local sometimes hangs when run with -R [In reply to]

Antoine Pitrou <pitrou [at] free> added the comment:

Committed, thanks.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7264>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 5, 2009, 6:42 AM

Post #10 of 10 (305 views)
Permalink
[issue7264] test_threading_local sometimes hangs when run with -R [In reply to]

Changes by Antoine Pitrou <pitrou [at] free>:


----------
resolution: -> fixed
stage: patch review -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7264>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.