Message314037
When I run your script I do not see any file descriptor associated with the queue when
subprocess.call(["ls", "-la", "/proc/%d/fd" % os.getpid()])
is executed.
This is my output if I just execute your program:
starting 3728
Starting 'external_application'
exit status 10
the 'external_application' application finished with exit status '10'...
Note the file descriptor #4 below
total 0
dr-x------ 2 pablogsal pablogsal 0 Mar 18 12:17 .
dr-xr-xr-x 9 pablogsal pablogsal 0 Mar 18 12:17 ..
lrwx------ 1 pablogsal pablogsal 64 Mar 18 12:17 0 -> /dev/pts/1
lrwx------ 1 pablogsal pablogsal 64 Mar 18 12:17 1 -> /dev/pts/1
lrwx------ 1 pablogsal pablogsal 64 Mar 18 12:17 2 -> /dev/pts/1
lr-x------ 1 pablogsal pablogsal 64 Mar 18 12:17 5 -> /dev/urandom
This is my output if I remove the call to "del queue":
starting 3892
Starting 'external_application'
exit status 10
the 'external_application' application finished with exit status '10'...
Note the file descriptor #4 below
total 0
dr-x------ 2 pablogsal pablogsal 0 Mar 18 12:18 .
dr-xr-xr-x 9 pablogsal pablogsal 0 Mar 18 12:18 ..
lrwx------ 1 pablogsal pablogsal 64 Mar 18 12:18 0 -> /dev/pts/1
lrwx------ 1 pablogsal pablogsal 64 Mar 18 12:18 1 -> /dev/pts/1
lrwx------ 1 pablogsal pablogsal 64 Mar 18 12:18 2 -> /dev/pts/1
l-wx------ 1 pablogsal pablogsal 64 Mar 18 12:18 4 -> 'pipe:[104568]'
lr-x------ 1 pablogsal pablogsal 64 Mar 18 12:18 5 -> /dev/urandom
So at least on my side "del queue" is having the desired effect.
Notice that calling
> del queue
does not destroy the object but just decrement in 1 the number of references to the object. To force collection of any possible cycles once you have destroyed all references on your side you can call
> import gc
> gc.collect() |
|
Date |
User |
Action |
Args |
2018-03-18 12:19:14 | pablogsal | set | recipients:
+ pablogsal, pitrou, davin, Henrique Andrade |
2018-03-18 12:19:14 | pablogsal | set | messageid: <1521375554.41.0.467229070634.issue33081@psf.upfronthosting.co.za> |
2018-03-18 12:19:14 | pablogsal | link | issue33081 messages |
2018-03-18 12:19:14 | pablogsal | create | |
|