Message289180
| Author |
Winterflower |
| Recipients |
Winterflower, davin, neologix, sbt, shanip |
| Date |
2017年03月07日.18:33:13 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1488911593.22.0.915119587411.issue23267@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I did some investigating using a test script and Python 3.7.0a0
from multiprocessing import Pool
import os
import time
def f(x):
time.sleep(30)
return x*x
if __name__=='__main__':
print('Main pid {0}'.format(os.getpid()))
p = Pool(5)
p.map(f, [1,2,3])
print('Returned')
time.sleep(30)
and grepping for pipe and the parentpid in the output from lsof ( lsof | grep python.*<parentpid>.*pipe ). The pipes opened at the start of the script are still open even after the line print('Returned') is executed. I suppose this is expected because I did not call *p.close()*. All pipes are cleaned up after the parent process finishes.
When I repeat the experiment calling p.close() after p.map returns, all that is left is the 9 pipes opened by the parent. All pipes are cleaned up after parent script exits.
@shani - could you please clarify how you were able to detect the leaking pipes? |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2017年03月07日 18:33:13 | Winterflower | set | recipients:
+ Winterflower, neologix, sbt, davin, shanip |
| 2017年03月07日 18:33:13 | Winterflower | set | messageid: <1488911593.22.0.915119587411.issue23267@psf.upfronthosting.co.za> |
| 2017年03月07日 18:33:13 | Winterflower | link | issue23267 messages |
| 2017年03月07日 18:33:13 | Winterflower | create |
|