[Twisted-Python] IOCP and CANCELLED asynchronous I/O operation

Justin Johnson justinjohnson at gmail.com
Mon Jul 18 13:52:13 EDT 2005

I am wondering if someone would be willing to assist me in debugging a 
problem I'm experiencing with my current attempt at an implementation of 
spawnProcess for the IOCP proactor.
 A patch with my implementation can be found at 
http://twistedmatrix.com/bugs/issue1008 along with comments and a log file 
describing my problem.
 The problem occurs sporadically when running 
First I create 3 pipes that will be used to write to the child process's 
stdin and read its stdout and stderr. Then I initiate a read on all 3 pipes. 
The reads makes sense for stdout and stderr. The stdin pipe is created in 
duplex mode and the read attempt on it from the parent is only there so we 
can detect when the child closes its end of the pipe so the parent can close 
its end as well.
 The problem is that occasionally (often, but not consistently) the read 
operations on stdin (and sometimes stderr) seem to not run at all and 
FileMon reports their status as CANCELLED when I get to the end of the 
program. If I run trial run through pdb and step through it, the result of 
CANCELLED for these 1 or 2 (if stderr fails as well) reads doesn't appear 
until the very end of the program. The callbacks (ReadInOp.ovDone and 
ReadErrOp.ovDone don't get called for either of these when the failure 
occurs, so FileMon's results seem to accurately reflect what is happening. 
However, from my print statements it is clear that the reads are initiated (
ReadInOp.initiateOp and ReadErrOp.initiateOp).
 The closest thing I can find to a description of what CANCELLED might mean 
is at http://www.cs.princeton.edu/~appel/smlnj/basis/posix-error.html which 
says it indicates that the associated asynchronous operation was cancelled 
before completion. This sounds correct, but doesn't help illuminate *why* 
this is happening.
 Does anyone have any suggestions as to why this is happening?
 Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20050718/ca6d9e4d/attachment.htm 

More information about the Twisted-Python mailing list