You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running "python -m test -R 2:3 test_multiprocessing_forkserver" on Windows, I saw some warnings about dangling threads. It may explain this issue.
I just created bpo-33929: "test_multiprocessing_spawn: WithProcessesTestProcess.test_many_processes() leaks 5 handles on Windows". See also my PR 7827.
It failed for the first time on Ubuntu and then was successful for all the rest of 5-6 runs. I don't know why for the failure run it has load avg as 0.00 and how to get to this stage.
# Shell session
➜ cpython git:(master) uname -a
Linux ubuntu-s-1vcpu-1gb-blr1-01 4.4.0-127-generic #153-Ubuntu SMP Sat May 19 10:58:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
➜ cpython git:(master) ./python
Python 3.8.0a0 (heads/master:d824ca7, Jul 3 2018, 06:50:05)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
➜ cpython git:(master) ./python -m test test_multiprocessing_spawn -m test.test_multiprocessing_spawn.WithProcessesTestPool.test_imap_unordered -R 3:3
Run tests sequentially
0:00:00 load avg: 0.00 [1/1] test_multiprocessing_spawn
beginning 6 repetitions
123456
......
test_multiprocessing_spawn leaked [2, 2, 1] memory blocks, sum=5
test_multiprocessing_spawn failed
== Tests result: FAILURE ==
1 test failed:
test_multiprocessing_spawn
Total duration: 9 sec 221 ms
Tests result: FAILURE
➜ cpython git:(master) ./python -m test test_multiprocessing_spawn -m test.test_multiprocessing_spawn.WithProcessesTestPool.test_imap_unordered -R 3:3
Run tests sequentially
0:00:00 load avg: 0.34 [1/1] test_multiprocessing_spawn
beginning 6 repetitions
123456
......
== Tests result: SUCCESS ==
1 test OK.
Total duration: 8 sec 822 ms
Tests result: SUCCESS
It failed for the first time on Ubuntu and then was successful for all the rest of 5-6 runs.
The bug is random. But the problem is that sometimes, it fails. It must never fail, otherwise the buildbot fails randomly. The Gentoo Refleak buildbot runs multiple tests in parallel and so its system load is high, tests are run slower, making the failure more likely.
Activity
vstinner commentedon Jun 1, 2018
http://buildbot.python.org/all/#/builders/132/builds/154
test_multiprocessing_spawn leaked [1, 2, 1] memory blocks, sum=4
vstinner commentedon Jun 1, 2018
When running "python -m test -R 2:3 test_multiprocessing_forkserver" on Windows, I saw some warnings about dangling threads. It may explain this issue.
vstinner commentedon Jun 13, 2018
bpo-33853 has been marked as a duplicate this bug.
vstinner commentedon Jun 20, 2018
That's the AMD64 Windows8.1 Refleaks 3.7 buildbot.
Copy of Pablo's message:
The test
test_multiprocessing_spawnis leaking memory according to the x86 Gentoo Refleaks 3.x buildbot:x86 Gentoo Refleaks 3.x
http://buildbot.python.org/all/#/builders/1/builds/253
test_multiprocessing_spawn leaked [1, 2, 1] memory blocks, sum=4
1 test failed again:
test_multiprocessing_spawn
x86 Gentoo Refleaks 3.7
http://buildbot.python.org/all/#/builders/114/builds/135
vstinner commentedon Jun 21, 2018
I just created bpo-33929: "test_multiprocessing_spawn: WithProcessesTestProcess.test_many_processes() leaks 5 handles on Windows". See also my PR 7827.
vstinner commentedon Jun 27, 2018
I also created bpo-33966: "test_multiprocessing_spawn.WithProcessesTestPool.test_traceback() leaks 4 handles on Windows".
vstinner commentedon Jul 3, 2018
I reproduced the issue on the Gentoo Refleak buildbot and I succeeded to bisect up to a single test: test_imap_unordered().
pydev@stormageddon ~/cpython $ ./python -m test test_multiprocessing_spawn -m test.test_multiprocessing_spawn.WithProcessesTestPool.test_imap_unordered -R 3:3
Run tests sequentially
0:00:00 load avg: 1.45 [1/1] test_multiprocessing_spawn
beginning 6 repetitions
123456
......
test_multiprocessing_spawn leaked [3, 2, 1] memory blocks, sum=6
test_multiprocessing_spawn failed
== Tests result: FAILURE ==
1 test failed:
test_multiprocessing_spawn
Total duration: 6 sec 548 ms
Tests result: FAILURE
vstinner commentedon Jul 3, 2018
It doesn't look like a real leak, but more a cache which takes multiple iterations to be fully filled.
pydev@stormageddon ~/cpython $ ./python -m test test_multiprocessing_spawn -m test.test_multiprocessing_spawn.WithProcessesTestPool.test_imap_unordered -R 1:30
WARNING: Running tests with --huntrleaks/-R and less than 3 warmup repetitions can give false positives!
Run tests sequentially
0:00:00 load avg: 0.88 [1/1] test_multiprocessing_spawn
beginning 31 repetitions
1234567890123456789012345678901
...............................
test_multiprocessing_spawn leaked [4, 5, 1, 5, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] memory blocks, sum=18
test_multiprocessing_spawn failed in 42 sec 470 ms
== Tests result: FAILURE ==
1 test failed:
test_multiprocessing_spawn
Total duration: 42 sec 490 ms
Tests result: FAILURE
vstinner commentedon Jul 3, 2018
Sorry, I forgot to mention that I modified libregrtest to get this output:
tirkarthi commentedon Jul 3, 2018
It failed for the first time on Ubuntu and then was successful for all the rest of 5-6 runs. I don't know why for the failure run it has load avg as 0.00 and how to get to this stage.
# Shell session
➜ cpython git:(master) uname -a Linux ubuntu-s-1vcpu-1gb-blr1-01 4.4.0-127-generic #153-Ubuntu SMP Sat May 19 10:58:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux ➜ cpython git:(master) ./python Python 3.8.0a0 (heads/master:d824ca7, Jul 3 2018, 06:50:05) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> exit() ➜ cpython git:(master) ./python -m test test_multiprocessing_spawn -m test.test_multiprocessing_spawn.WithProcessesTestPool.test_imap_unordered -R 3:3 Run tests sequentially 0:00:00 load avg: 0.00 [1/1] test_multiprocessing_spawn beginning 6 repetitions 123456 ...... test_multiprocessing_spawn leaked [2, 2, 1] memory blocks, sum=5 test_multiprocessing_spawn failed== Tests result: FAILURE ==
1 test failed:
test_multiprocessing_spawn
Total duration: 9 sec 221 ms
Tests result: FAILURE
➜ cpython git:(master) ./python -m test test_multiprocessing_spawn -m test.test_multiprocessing_spawn.WithProcessesTestPool.test_imap_unordered -R 3:3
Run tests sequentially
0:00:00 load avg: 0.34 [1/1] test_multiprocessing_spawn
beginning 6 repetitions
123456
......
== Tests result: SUCCESS ==
1 test OK.
Total duration: 8 sec 822 ms
Tests result: SUCCESS
vstinner commentedon Jul 3, 2018
The bug is random. But the problem is that sometimes, it fails. It must never fail, otherwise the buildbot fails randomly. The Gentoo Refleak buildbot runs multiple tests in parallel and so its system load is high, tests are run slower, making the failure more likely.
Anyway, I have a fix! PR 8059.
vstinner commentedon Jul 3, 2018
New changeset 23401fb by Victor Stinner in branch 'master':
bpo-33735: Fix test_multiprocessing random failure (GH-8059)
23401fb
miss-islington commentedon Jul 3, 2018
New changeset 42b2f84 by Miss Islington (bot) in branch '3.7':
bpo-33735: Fix test_multiprocessing random failure (GH-8059)
42b2f84
vstinner commentedon Jul 3, 2018
New changeset 53fafaf by Victor Stinner in branch '2.7':
bpo-33735: Fix test_multiprocessing random failure (GH-8059) (GH-8061)
53fafaf
miss-islington commentedon Jul 3, 2018
New changeset 3bd9d3b by Miss Islington (bot) in branch '3.6':
bpo-33735: Fix test_multiprocessing random failure (GH-8059)
3bd9d3b
vstinner commentedon Jul 3, 2018
bpo-33984 has been marked as a duplicate of this issue: "test_multiprocessing_forkserver leaked [1, 2, 1] memory blocks on x86 Gentoo Refleaks 3.x".
Sadly, my commit 23401fb is not perfect, the test still fails when the system load is high:
https://bugs.python.org/issue33984#msg320967
But since tests are re-run sequentially, I hope that it will be fine.
I close the issue. I will reopen it if the bug reoccurs.
pablogsal commentedon Jul 5, 2018
We have some similar failures on the x86 Gentoo Refleaks 3.7 buildbots:
http://buildbot.python.org/all/#/builders/114/builds/157/steps/4/logs/stdio
http://buildbot.python.org/all/#/builders/114/builds/155/steps/4/logs/stdio
----------------------------------------------------------------------
Ran 310 tests in 249.377s
OK (skipped=30)
.
test_multiprocessing_spawn leaked [1, 2, 2] memory blocks, sum=5
1 test failed again:
test_multiprocessing_spawn
== Tests result: FAILURE then FAILURE ==
It seems that is due to a high load on the buildbot but I am surprised that this is not mitigated after PR 8059.
vstinner commentedon Jul 5, 2018
Ok ok, let me be honest with myself, my *workaround* change is not reliable :-)
vstinner commentedon Jul 10, 2018
Note for myself: the commit 127bd9b, fix for bpo-34042 has no impact on this issue since this issue is about memory blocks and not references.
vstinner commentedon Dec 18, 2018
Even if the code isn't perfect, I didn't see the failure recently. So I close the bug again.