Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server process of shared_memory shuts down if KeyboardInterrupt #80549

Closed
pierreglaser mannequin opened this issue Mar 19, 2019 · 5 comments
Closed

server process of shared_memory shuts down if KeyboardInterrupt #80549

pierreglaser mannequin opened this issue Mar 19, 2019 · 5 comments
Labels
3.8 (EOL) end of life type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@pierreglaser
Copy link
Mannequin

pierreglaser mannequin commented Mar 19, 2019

BPO 36368
Nosy @pitrou, @applio, @pierreglaser
PRs
  • bpo-36368: Ignore SIGINT in SharedMemoryManager servers. #12483
  • Files
  • 0001-FIX-protect-shared_memory-server-from-SIGINT.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-05-18.12:38:22.883>
    created_at = <Date 2019-03-19.16:38:01.480>
    labels = ['3.8', 'type-crash']
    title = 'server process of shared_memory shuts down if KeyboardInterrupt'
    updated_at = <Date 2019-05-18.12:38:22.883>
    user = 'https://github.com/pierreglaser'

    bugs.python.org fields:

    activity = <Date 2019-05-18.12:38:22.883>
    actor = 'pierreglaser'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-05-18.12:38:22.883>
    closer = 'pierreglaser'
    components = []
    creation = <Date 2019-03-19.16:38:01.480>
    creator = 'pierreglaser'
    dependencies = []
    files = ['48222']
    hgrepos = []
    issue_num = 36368
    keywords = ['patch']
    message_count = 5.0
    messages = ['338380', '338488', '338489', '338548', '342117']
    nosy_count = 3.0
    nosy_names = ['pitrou', 'davin', 'pierreglaser']
    pr_nums = ['12483']
    priority = 'normal'
    resolution = None
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue36368'
    versions = ['Python 3.8']

    @pierreglaser
    Copy link
    Mannequin Author

    pierreglaser mannequin commented Mar 19, 2019

    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.

    @pierreglaser pierreglaser mannequin added 3.8 (EOL) end of life type-crash A hard crash of the interpreter, possibly with a core dump labels Mar 19, 2019
    @pitrou
    Copy link
    Member

    pitrou commented Mar 20, 2019

    Your patch sounds good on the principle, but can you make a patch out of it?

    @pitrou
    Copy link
    Member

    pitrou commented Mar 20, 2019

    Sorry - I meant make a *PR* out of it :-)

    @pierreglaser
    Copy link
    Mannequin Author

    pierreglaser mannequin commented Mar 21, 2019

    Done.

    @pitrou
    Copy link
    Member

    pitrou commented May 10, 2019

    New changeset d0d64ad by Antoine Pitrou (Pierre Glaser) in branch 'master':
    bpo-36368: Ignore SIGINT in SharedMemoryManager servers. (GH-12483)
    d0d64ad

    @pierreglaser pierreglaser mannequin closed this as completed May 18, 2019
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 (EOL) end of life type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant