python / cpython

The Python programming language
https://www.python.org
Other
62.28k stars 29.92k forks source link

``test_functools`` sometimes leaks references #120163

Open Eclips4 opened 3 months ago

Eclips4 commented 3 months ago

The text below is a part of the refleak tests, and unfortunately, I am unable to constantly reproduce it :(

0:13:26 load avg: 7.84 [201/478/1] test_functools failed (reference leak) -- running (3): test.test_multiprocessing_spawn.test_processes (7 min 14 sec), test_embed (1 min 12 sec), test_faulthandler (55.3 sec)
beginning 6 repetitions. Showing number of leaks (. for 0 or less, X for 10 or more)
123:456
XX1 111
adiaholic commented 3 months ago

I was able to reproduce this:

0:00:00 load avg: 1.70 Run 1 test sequentially in a single process 0:00:00 load avg: 1.70 [1/1] test_functools beginning 6 repetitions. Showing number of leaks (. for 0 or less, X for 10 or more) 123:456 XX. 3.. test_functools leaked [3, 0, 0] memory blocks, sum=3 (this is fine)

adiaholic commented 3 months ago

@Eclips4, I stumbled upon this which suggests that this scenario might be false positive and an outcome of late initialization and not a real leak. Since it is false positive it is difficult to constantly reproduce it. If this needs further attention please let me know, I'm happy to look into it more if you suggest so :)

vstinner commented 2 months ago

Previous issue: https://github.com/python/cpython/issues/80741

vstinner commented 1 month ago

See also commit 5f660e8e2ca3acfb89ccbdd990f072149b6baa6a: fix for test_typing.