classification
Title: server process of shared_memory shuts down if KeyboardInterrupt
Type: crash Stage: resolved
Components: Versions: Python 3.8
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: davin, pierreglaser, pitrou
Priority: normal Keywords: patch

Created on 2019-03-19 16:38 by pierreglaser, last changed 2019-05-18 12:38 by pierreglaser. This issue is now closed.

Files
File name Uploaded Description Edit
0001-FIX-protect-shared_memory-server-from-SIGINT.patch pierreglaser, 2019-03-19 16:38
Pull Requests
URL Status Linked Edit
PR 12483 merged pierreglaser, 2019-03-21 15:10
Messages (5)
msg338380 - (view) Author: Pierre Glaser (pierreglaser) * Date: 2019-03-19 16:38
When starting a SharedMemoryManager in an interactive session, any KeyboardInterrupt event will be transmitted to the (sub)process running the shared memory server, which causes the Manager to be unusable thereafter:

>>> from multiprocessing.managers import SharedMemoryManager
>>> smm = SharedMemoryManager()
>>> smm.start()
>>> start typing something wrong
KeyboardInterrupt
>>> sl = smm.ShareableList(range(10))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pierreglaser/repos/cpython/Lib/multiprocessing/managers.py", line 1342, in ShareableList
    with self._Client(self._address, authkey=self._authkey) as conn:
  File "/home/pierreglaser/repos/cpython/Lib/multiprocessing/connection.py", line 502, in Client
    c = SocketClient(address)
  File "/home/pierreglaser/repos/cpython/Lib/multiprocessing/connection.py", line 629, in SocketClient
    s.connect(address)
FileNotFoundError: [Errno 2] No such file or directory


I suggest ignoring SIGINT in the server process.
msg338488 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2019-03-20 15:57
Your patch sounds good on the principle, but can you make a patch out of it?
msg338489 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2019-03-20 15:58
Sorry - I meant make a *PR* out of it :-)
msg338548 - (view) Author: Pierre Glaser (pierreglaser) * Date: 2019-03-21 15:12
Done.
msg342117 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2019-05-10 18:42
New changeset d0d64ad1f5f1dc1630004091d7f8209546c1220a by Antoine Pitrou (Pierre Glaser) in branch 'master':
bpo-36368: Ignore SIGINT in SharedMemoryManager servers. (GH-12483)
https://github.com/python/cpython/commit/d0d64ad1f5f1dc1630004091d7f8209546c1220a
History
Date User Action Args
2019-05-18 12:38:22pierreglasersetstatus: open -> closed
stage: patch review -> resolved
2019-05-10 18:42:39pitrousetmessages: + msg342117
2019-03-21 15:12:09pierreglasersetmessages: + msg338548
2019-03-21 15:10:56pierreglasersetstage: patch review
pull_requests: + pull_request12436
2019-03-20 15:58:13pitrousetmessages: + msg338489
2019-03-20 15:57:51pitrousetmessages: + msg338488
2019-03-19 16:38:01pierreglasercreate