This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mutax
Recipients mutax
Date 2021-07-12.22:07:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1626127665.43.0.394299771131.issue44614@roundup.psfhosted.org>
In-reply-to
Content
It seems that the shutdown() method of the Server in in managers.py is already sending the result of its execution directly into the connection, and then the handle_request() method is trying to send ('#RETURN', None) yet again after returning from the call to shutdown() which sometimes yields a Broken Pipe Exception.

with the following line in handle_request():
    result = func(c, *args, **kwds)
a call to shutown() is made, and in shutdown() I see:
    c.send(('#RETURN', None))

and back in handle_request():
    msg = ('#RETURN', result)
…
    c.send(msg)

attached you find a minimal example that shows this behaviour sometimes, if logging is set to not more than DEBUG. I am guessing that the Broken Pipe depends on a race with the other side being closed.

Although the race condition does not look like having an impact, it is highly confusing when debugging. 


log:
      INFO           MainProcess         util.py:54  sending shutdown message to manager
     DEBUG        BaseManager-12         util.py:50  manager received shutdown message
      INFO        BaseManager-12         util.py:54  Failure to send message: ('#RETURN', None)
      INFO        BaseManager-12         util.py:54  process shutting down
      INFO        BaseManager-12         util.py:54   ... request was (None, 'shutdown', (), {})
     DEBUG        BaseManager-12         util.py:50  running all "atexit" finalizers with priority >= 0
      INFO        BaseManager-12         util.py:54   ... exception was BrokenPipeError(32, 'Broken pipe')
     DEBUG        BaseManager-12         util.py:50  running the remaining "atexit" finalizers
      INFO        BaseManager-12         util.py:54  process exiting with exitcode 0
History
Date User Action Args
2021-07-12 22:07:45mutaxsetrecipients: + mutax
2021-07-12 22:07:45mutaxsetmessageid: <1626127665.43.0.394299771131.issue44614@roundup.psfhosted.org>
2021-07-12 22:07:45mutaxlinkissue44614 messages
2021-07-12 22:07:45mutaxcreate