[Python-Dev] Investigated ref leak report related to thread (regrtest.py -R ::) (original) (raw)
ocean ocean at m2.ccsnet.ne.jp
Mon Jun 18 15:02:56 CEST 2007
- Previous message: [Python-Dev] [Pydotorg] Upgrade of {www,svn}.python.org
- Next message: [Python-Dev] Investigated ref leak report related to thread(regrtest.py -R ::)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello. I investigated ref leak report related to thread. Please run python regrtest.py -R :: test_leak.py (attached file) Sometimes ref leak is reported.
I saw this as regression failure on python-checkins.
total ref count 92578 -> 92669
_Condition 2 Thread 6 _Event 1 bool 10 instancemethod 1 code 2 dict 9 file 1 frame 3 function 2 int 1 list 2 builtin_function_or_method 5 NoneType 2 str 27 thread.lock 7 tuple 5 type 5
Probably this happens because threading.Thread is implemented as Python code, (expecially threading.Thread#join), the code of regrtest.py
if i >= nwarmup:
deltas.append(sys.gettotalrefcount() - rc - 2)
can run before thread really quits. (before Moudles/threadmodule.c t_bootstrap()'s
Py_DECREF(boot->func); Py_DECREF(boot->args); Py_XDECREF(boot->keyw);
runs)
So I experimentally inserted the code to wait for thread termination. (attached file experimental.patch) And I confirmed error was gone.
Sorry for hackish patch which only runs on windows. It should run
on other platforms if you replace Sleep() in Python/sysmodule.c
sys_debug_ref_leak_leave() with appropriate function.
-------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test_leak.py Url: http://mail.python.org/pipermail/python-dev/attachments/20070618/b26e2d48/attachment.asc -------------- next part -------------- A non-text attachment was scrubbed... Name: experimental.patch Type: application/octet-stream Size: 2690 bytes Desc: not available Url : http://mail.python.org/pipermail/python-dev/attachments/20070618/b26e2d48/attachment.obj
- Previous message: [Python-Dev] [Pydotorg] Upgrade of {www,svn}.python.org
- Next message: [Python-Dev] Investigated ref leak report related to thread(regrtest.py -R ::)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]