Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2977)

Issue 12328: multiprocessing's overlapped PipeConnection on Windows

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 months, 2 weeks ago by shibturn
Modified:
2 months, 3 weeks ago
Reviewers:
pitrou
CC:
AntoinePitrou, mail_timgolden.me.uk, jnoller_gmail.com, brian.curtin, devnull_psf.upfronthosting.co.za, sbt, brian.curtin, devnull_psf.upfronthosting.co.za
Visibility:
Public.

Patch Set 1 #

Patch Set 2 #

Patch Set 3 #

Patch Set 4 #

Total comments: 19

Patch Set 5 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Doc/library/multiprocessing.rst View 5 chunks +77 lines, -5 lines 0 comments Download
Lib/concurrent/futures/process.py View 4 3 chunks +8 lines, -4 lines 0 comments Download
Lib/multiprocessing/connection.py View 1 2 4 11 chunks +216 lines, -116 lines 0 comments Download
Lib/multiprocessing/queues.py View 4 4 chunks +5 lines, -4 lines 0 comments Download
Lib/test/test_multiprocessing.py View 2 4 2 chunks +234 lines, -1 line 0 comments Download
Modules/_multiprocessing/win32_functions.c View 1 2 3 4 10 chunks +42 lines, -27 lines 0 comments Download

Messages

Total messages: 2
AntoinePitrou
http://bugs.python.org/review/12328/diff/4322/15506 File Lib/multiprocessing/connection.py (right): http://bugs.python.org/review/12328/diff/4322/15506#newcode309 Lib/multiprocessing/connection.py:309: ov, err = win32.ReadFile(self._handle, 128, overlapped=True) Shouldn't it be ...
2 months, 3 weeks ago #1
sbt
2 months, 3 weeks ago #2
http://bugs.python.org/review/12328/diff/4322/15506
File Lib/multiprocessing/connection.py (right):

http://bugs.python.org/review/12328/diff/4322/15506#newcode309
Lib/multiprocessing/connection.py:309: ov, err = win32.ReadFile(self._handle,
128, overlapped=True)
On 2012/03/04 21:19:22, AntoinePitrou wrote:
> Shouldn't it be bsize instead of 128? bsize looks otherwise unused.
> 
Yes

http://bugs.python.org/review/12328/diff/4322/15506#newcode337
Lib/multiprocessing/connection.py:337: def _poll(self, timeout, maxsize=None):
On 2012/03/04 21:19:22, AntoinePitrou wrote:
> Why does _poll take a maxsize?
That is left over from an older version.

http://bugs.python.org/review/12328/diff/4322/15506#newcode345
Lib/multiprocessing/connection.py:345: def _poll_and_not_empty_string(self):
On 2012/03/04 21:19:22, AntoinePitrou wrote:
> Isn't the name of the method misleading, since it will return True if
> _got_empty_message is True?
> Also, shouldn't this be the same as calling _poll() with timeout=0?
You are right, this is no longer needed.

http://bugs.python.org/review/12328/diff/4322/15506#newcode776
Lib/multiprocessing/connection.py:776: elif WAIT_OBJECT_0 <= res <=
WAIT_OBJECT_0 + len(L):
On 2012/03/04 21:19:22, AntoinePitrou wrote:
> Shouldn't the second inequality sign be strict?
> I.e. `... <= res < ...`.
> 
Yes

http://bugs.python.org/review/12328/diff/4322/15506#newcode778
Lib/multiprocessing/connection.py:778: elif WAIT_ABANDONED_0 <= res <=
WAIT_ABANDONED_0 + len(L):
On 2012/03/04 21:19:22, AntoinePitrou wrote:
> Same here.
> 
Yes

http://bugs.python.org/review/12328/diff/4322/15506#newcode788
Lib/multiprocessing/connection.py:788: win32.ERROR_NETNAME_DELETED}
On 2012/03/04 21:19:22, AntoinePitrou wrote:
> What does ERROR_NETNAME_DELETED mean? Does it occur with named pipes?
> (and can 0 really occur?)
> 
It can occur when using overlapped reads on a socket (instead of
ERROR_BROKEN_PIPE).  And I don't think 0 should be in there.

http://bugs.python.org/review/12328/diff/4322/15507
File Lib/multiprocessing/queues.py (right):

http://bugs.python.org/review/12328/diff/4322/15507#newcode103
Lib/multiprocessing/queues.py:103: # PipeConnection.poll() is not thread-safe. 
Since the
On 2012/03/04 21:19:22, AntoinePitrou wrote:
> Actually, it looks like poll(0) should be thread-safe, if it's optimized to
only
> call PeekNamedPipe().
> 
In earlier versions of the patch, a successful poll would read a whole message
and not be atomic.  This is no longer necessary.

http://bugs.python.org/review/12328/diff/4322/15508
File Lib/test/test_multiprocessing.py (right):

http://bugs.python.org/review/12328/diff/4322/15508#newcode2486
Lib/test/test_multiprocessing.py:2486: class TestWait(unittest.TestCase):
On 2012/03/04 21:19:22, AntoinePitrou wrote:
> It seems there are no tests for the timeout parameter, or for passing numeric
> handles to wait().
> 
I will write some.

http://bugs.python.org/review/12328/diff/4322/15509
File Modules/_multiprocessing/win32_functions.c (right):

http://bugs.python.org/review/12328/diff/4322/15509#newcode105
Modules/_multiprocessing/win32_functions.c:105: self->completed = 1;
On 2012/03/04 21:19:22, AntoinePitrou wrote:
> Does ERROR_OPERATION_ABORTED still allow for some bytes to have been
> transferred?
> 
I don't think so.  But the only cases we really care about are (1) zero length
reads where I am sure it does happen, and (2) cases where the read is
interrupted by SIGINT where potential corruption is just as much of a problem on
Unix.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld