[Twisted-Python] Process completion not detected on HP-UX (#608)

Glenn Hochberg gah at research.att.com
Tue Aug 8 10:59:00 MDT 2006


After much staring at the Twisted code and some experimenting, I  
finally discovered the nature of the problem.

The semantics of the select() call on HP-UX with respect to pipes is  
a bit different than the other OS's I have access to (i.e. Linux,  
Solaris, and Mac OS X).
In particular, the "read hack" in process.py does not work, because  
select shows the write-end of a pipe being both readable and writable  
whenever there is data in the pipe and the pipe is not full.  There  
does not appear to be any way to detect when all readers of the pipe  
have closed without actually writing at least one byte to the write- 
end (in which case you get a broken pipe error, as one would expect).

As a temporary workaround, I am doing the following in process.py:

a) detecting hp-ux pipe behavior and setting a global  
brokenHpUxPipeBehavior
b) disabling the read hack if this variable is set
c) in Process.processEnded() I check for the variable and if set,  
send closeConnection to each ProcessWriter in the pipes dict

This seems to do the trick.

I have posted to the comp.unix.hp.hpux newsgroup looking for a way to  
determine if the readers are all gone, but don't know whether one  
will turn up or not.

Anyone have any suggestions on better ways to fix this?

	-Glenn

On Jul 31, 2006, at 4:36 PM, Jean-Paul Calderone wrote:

> On Mon, 31 Jul 2006 15:58:40 -0400, Glenn Hochberg  
> <gah at research.att.com> wrote:
>>
>> What approach would you recommend in troubleshooting the problem-- 
>> is  there built-in debugging that can be turned on that might give  
>> me  some more detailed information, or do I need to start adding  
>> log or  print statements?
>>
>> Again, any help would be appreciated.
>>
>
> Run one of the unit tests which fails in debug mode.  For example,
>
>  trial -b twisted.trial.test.test_process.ProcessTestCase.testProcess
>
> If none of the existing unit tests fail, write a new one :)
>
> Jean-Paul





More information about the Twisted-Python mailing list