Author fossilet
Recipients Chris Langton, Henrique Andrade, davin, fossilet, pablogsal, pitrou
Date 2019-03-22.07:47:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1553240857.65.0.628644102144.issue33081@roundup.psfhosted.org>
In-reply-to
Content
On macOS with Python 3.7.2, using pitrou's code, I suspect Python does not delete some semaphores used by Queue.

Run these: 

import multiprocessing
import os
import threading

os.system('lsof -p {} | grep -v txt'.format(os.getpid()))
q = multiprocessing.Queue()
q.put(1)
q.get()
threading.enumerate()
os.system('lsof -p {} | grep -v txt'.format(os.getpid()))
q.close()
threading.enumerate()
os.system('lsof -p {} | grep -v txt'.format(os.getpid()))

I see:
>>> import multiprocessing
>>> import os
>>> import threading
>>> 
>>> os.system('lsof -p {} | grep -v txt'.format(os.getpid()))
COMMAND   PID USER   FD   TYPE DEVICE  SIZE/OFF     NODE NAME
Python  56029  tux  cwd    DIR    1,4        96  1927156 /Users/tux/Desktop
Python  56029  tux    0u   CHR   16,2 0t2867183     2393 /dev/ttys002
Python  56029  tux    1u   CHR   16,2 0t2867183     2393 /dev/ttys002
Python  56029  tux    2u   CHR   16,2 0t2867183     2393 /dev/ttys002
0
>>> q = multiprocessing.Queue()
>>> q.put(1)
>>> q.get()
1
>>> threading.enumerate()
[<_MainThread(MainThread, started 4570830272)>, <Thread(QueueFeederThread, started daemon 123145368662016)>]
>>> os.system('lsof -p {} | grep -v txt'.format(os.getpid()))
COMMAND   PID USER   FD     TYPE             DEVICE  SIZE/OFF     NODE NAME
Python  56029  tux  cwd      DIR                1,4        96  1927156 /Users/tux/Desktop
Python  56029  tux    0u     CHR               16,2 0t2867914     2393 /dev/ttys002
Python  56029  tux    1u     CHR               16,2 0t2867914     2393 /dev/ttys002
Python  56029  tux    2u     CHR               16,2 0t2867914     2393 /dev/ttys002
Python  56029  tux    3     PIPE 0x5ab56e2f13ca4abb     16384          ->0x5ab56e2f13ca5a7b
Python  56029  tux    4     PIPE 0x5ab56e2f13ca5a7b     16384          ->0x5ab56e2f13ca4abb
Python  56029  tux    5r  PSXSEM                          0t0          /mp-oa1x27kb
Python  56029  tux    6r  PSXSEM                          0t0          /mp-khu1swie
Python  56029  tux    7r  PSXSEM                          0t0          /mp-pwrgzmzz
0
>>> q.close()
>>> threading.enumerate()
[<_MainThread(MainThread, started 4570830272)>]
>>> os.system('lsof -p {} | grep -v txt'.format(os.getpid()))
COMMAND   PID USER   FD     TYPE DEVICE  SIZE/OFF     NODE NAME
Python  56029  tux  cwd      DIR    1,4        96  1927156 /Users/tux/Desktop
Python  56029  tux    0u     CHR   16,2 0t2869010     2393 /dev/ttys002
Python  56029  tux    1u     CHR   16,2 0t2869010     2393 /dev/ttys002
Python  56029  tux    2u     CHR   16,2 0t2869010     2393 /dev/ttys002
Python  56029  tux    5r  PSXSEM              0t0          /mp-oa1x27kb
Python  56029  tux    6r  PSXSEM              0t0          /mp-khu1swie
Python  56029  tux    7r  PSXSEM              0t0          /mp-pwrgzmzz

The three PSXSEM persists even after some time. Is this some type of leakage?
History
Date User Action Args
2019-03-22 07:47:37fossiletsetrecipients: + fossilet, pitrou, davin, Henrique Andrade, pablogsal, Chris Langton
2019-03-22 07:47:37fossiletsetmessageid: <1553240857.65.0.628644102144.issue33081@roundup.psfhosted.org>
2019-03-22 07:47:37fossiletlinkissue33081 messages
2019-03-22 07:47:37fossiletcreate