[Checkins] [zopefoundation/zope.server] bfd9f7: Fix pipetrigger.close() to close the right file de...
GitHub
noreply at github.com
Fri Oct 19 14:54:46 CEST 2018
Branch: refs/heads/fix-pipetrigger
Home: https://github.com/zopefoundation/zope.server
Commit: bfd9f7bad9d2b0b2a2367a17ddd0587449e35716
https://github.com/zopefoundation/zope.server/commit/bfd9f7bad9d2b0b2a2367a17ddd0587449e35716
Author: Marius Gedminas <marius at gedmin.as>
Date: 2018-10-19 (Fri, 19 Oct 2018)
Changed paths:
M CHANGES.rst
M src/zope/server/tests/test_trigger.py
M src/zope/server/trigger.py
Log Message:
-----------
Fix pipetrigger.close() to close the right file descriptors
Here's what was happening:
- pipetrigger.__init__() creates two file descriptors by invoking os.pipe(),
let's call them r1 and w1
- asyncore.file_dispatcher.__init__() wraps r1 in a file_wrapper() that
does an os.dup(), creating r2
- pipetrigger.__init__() closes r1
- pipetrigger.__init__() keeps self._fd = (r1, w1) despite r1 being
closed already!
- pipetrigger._close() closes all desciptors from self._fd, closing r1
again (causing an OSError for EBADF or closing a random real file the
program still wants to use), but doesn't close self.socket, which is
the file_wrapper instance holding r2 open.
I also had to fix one test that was calling trigger.close() and
expecting trigger.recv() to keep working afterwards.
**NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/
Functionality will be removed from GitHub.com on January 31st, 2019.
More information about the checkins
mailing list