Skip to content

multiprocessing Server's shutdown method useless send message to manager #76195

Open

Description

@subler
mannequin
BPO 32014
Nosy @pitrou, @applio, @Subler

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 = None
created_at = <Date 2017-11-13.06:00:30.342>
labels = ['type-bug', 'library']
title = "multiprocessing Server's shutdown method useless send message to manager"
updated_at = <Date 2017-11-13.06:00:30.342>
user = 'https://github.com/subler'

bugs.python.org fields:

activity = <Date 2017-11-13.06:00:30.342>
actor = 'stevezh'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2017-11-13.06:00:30.342>
creator = 'stevezh'
dependencies = []
files = []
hgrepos = []
issue_num = 32014
keywords = []
message_count = 1.0
messages = ['306142']
nosy_count = 5.0
nosy_names = ['pitrou', 'jnoller', 'sbt', 'davin', 'stevezh']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue32014'
versions = ['Python 3.5', 'Python 3.6']

Activity

  1. subler commented on Nov 13, 2017

    sublermannequin
    MannequinAuthor

    When shutdown the manager, Server's handle_request will send back message to the manager, so is useless for the Server's shutdown method send back "None" to the manager?

    Source code from Lib/multiprocessing/managers.py:

        def shutdown(self, c):
            '''
            Shutdown this process
            '''
            try:
                util.debug('manager received shutdown message')
                # Is useless here?
                c.send(('#RETURN', None))
            except:
                import traceback
                traceback.print_exc()
            finally:
                self.stop_event.set()

    Server's handle_request may throw and catch exception because the conn is closed in _finalize_manager() after Server's shutdown method returns.

    code from handle_request():

        try:
            c.send(msg)
        except Exception as e:
            try:
                c.send(('#TRACEBACK', format_exc()))
            except Exception:
                pass
    

    code from _finalize_manager():

            try:
                conn = _Client(address, authkey=authkey)
                try:
                    dispatch(conn, None, 'shutdown')
                finally:
                    conn.close()
            except Exception:
                pass
    

    Also the Server's shutdown method only used by manager class.

  2. added
    stdlib
    type-bug
    on Nov 13, 2017
  3. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibtopic-multiprocessingtype-bug

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions