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.

classification
Title: Python hangs on FreeBSD7 in test_capi
Type: behavior Stage:
Components: None Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: trent Nosy List: amaury.forgeotdarc, gpolo, trent, trepan
Priority: normal Keywords:

Created on 2008-04-06 16:05 by trepan, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
backtrace trepan, 2008-04-06 16:08 GDB Backtrace
Messages (7)
msg65043 - (view) Author: Taavi Repän (trepan) Date: 2008-04-06 16:08
When doing import.test_autotest, test_capi hangs.
It seems that threads 1,2,3 are trying to acquire import lock, which is
owned by thread 4, which is trying to lock some other lock.

Python 2.5.2 (r252:60911, Apr  6 2008, 17:28:23) 
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd7
msg65159 - (view) Author: Trent Nelson (trent) * (Python committer) Date: 2008-04-08 13:51
Ahh, more FreeBSD threading woes.  If no-one beats me to it, I'll be 
able to start taking a look at this when our FreeBSD 7 server is up in 
a week or so.
msg65161 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008-04-08 13:53
Hi Trent,

FreeBSD 7 uses libthr as default, which would possibly eliminate this
problem.
msg65165 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-04-08 14:35
I think that this problem is not FreeBSD specific:
- "import test.autotest" runs the whole test suite as a side-effect of
an import statement.
- in the test suite test_capi spawns threads, which also import.
- a lock ensues...

See for example test_threaded_import.py::

    if imp.lock_held():
        # This triggers on, e.g., from test import autotest.
        raise TestSkipped("can't run when import lock is held")

I the test_capi case, I think that the two imports in TestThreadState
should be moved outside the function.

Also, the backtrace file shows two other threads locked in a "import
socket" statement. I suspect problems in test_urllib2.py or
test_urllib2net.py...
msg65202 - (view) Author: Taavi Repän (trepan) Date: 2008-04-08 18:24
I don't that the problem is in tests. For example
  import pygtk
  import gtk
hangs also. I don't have backtrace for PyGtk hang yet, but it hangs in
ucond state too (like test_capi).
msg65216 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-04-08 21:04
In any case, I reproduce the problem on Windows too.
msg65220 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-04-08 21:28
Committed r62229. Please file a separate issue for the gtk module, it's
really another thing.
History
Date User Action Args
2022-04-11 14:56:33adminsetgithub: 46816
2008-04-08 21:28:47amaury.forgeotdarcsetstatus: open -> closed
resolution: fixed
messages: + msg65220
2008-04-08 21:04:55amaury.forgeotdarcsetmessages: + msg65216
2008-04-08 18:24:39trepansetmessages: + msg65202
2008-04-08 14:35:32amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg65165
2008-04-08 13:53:25gpolosetnosy: + gpolo
messages: + msg65161
2008-04-08 13:51:04trentsetassignee: trent
messages: + msg65159
nosy: + trent
2008-04-06 16:08:35trepansetfiles: + backtrace
messages: + msg65043
2008-04-06 16:05:14trepancreate