New submission from Martin Panter: After running the 2.7 test suite many times, my Linux OS’s memory slowly gets eaten up. It seems to be because of zombie Python processes that never get cleaned up unless I kill them explicitly. I never get this problem with the Python 3 test suite.
I narrowed it down to running test_tcl followed by test_thread, and then narrowed it even further to importing _tkinter and running TestForkInThread.test_forkinthread(). Now I have it minimized to the following: $ ./python -c 'import _tkinter, thread, os; thread.start_new_thread(os.fork, ())' A process is left behind listed with the “defunct” or Z (zombie) status. However it has a child thread; maybe this is why it does not automatically get cleaned up. Extract from “htop”: PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 1 root 20 0 35412 4528 3448 S 0.0 0.2 0:01.25 /sbin/init 12615 vadmium 20 0 0 0 0 Z 0.0 0.0 0:00.00 ├─ python 12616 vadmium 20 0 142M 5952 2220 S 0.0 0.3 0:00.00 │ └─ ./python -c import _tkinter, thread, os; thread.start_new_thread(os.fork, ()) $ sudo strace -p 12616 Process 12616 attached - interrupt to quit select(4, [3], [], [], NULL^C <unfinished ...> Process 12616 detached $ ls -l /proc/12616/fd total 0 lrwx------ 1 vadmium users 64 Feb 29 05:57 0 -> /dev/pts/1 lrwx------ 1 vadmium users 64 Feb 29 05:57 1 -> /dev/pts/1 lrwx------ 1 vadmium users 64 Feb 29 05:57 2 -> /dev/pts/1 lr-x------ 1 vadmium users 64 Feb 29 05:57 3 -> pipe:[946176] lr-x------ 1 vadmium users 64 Feb 29 05:57 4 -> pipe:[946321] l-wx------ 1 vadmium users 64 Feb 29 05:57 5 -> pipe:[946176] $ pacman -Q systemd glibc systemd 222-1 glibc 2.22-4 ---------- components: Tests, Tkinter messages: 260993 nosy: martin.panter priority: normal severity: normal status: open title: import _tkinter + TestForkInThread leaves zombie with stalled thread type: resource usage versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26456> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com