← Back to team overview

launchpad-dev team mailing list archive

Re: Proof-of-concept 'forking' lp-serve

 

On 18 August 2010 00:13, John Arbash Meinel <john@xxxxxxxxxxxxxxxxx> wrote:
>>>> There is some concern that we won't easily detect when the smart
>>>> server is finished going this route.  As I at least wasn't seeing it
>>>> disconnect from the fifo (echo foo > script, sends a POLLHUP event to
>>>> select when the input is finished, I wasn't seeing that when lp-serve
>>>> on the other side of a fifo finished.)
>>> Ah, I see.
>>
>> According to the poll(2) manpage and my rusty understanding, you get
>> POLLHUP only when the remote end closes a socket you're trying to
>> write to, and probably only if this causes you to lose
>> already-buffered data.  If the client closes a socket you're trying to
>> read from, I would expect you to get POLLIN and then find an EOF, or
>> to get POLLRDHUP (which may not be exposed in Python.)
>>
>> It's great to see this coming along.
>
> Well, I *am* getting it when stdin finishes. I do have some code that
> says "if event & POLLIN and not bytes" (if I got the POLLIN event but
> there was no content) consider the connection closed. But I don't seem
> to be getting that.
>
> Which is also weird because 'cat /.../fifo' finishes correctly.
>
> Anyway, ideally I wouldn't need the proxy in the middle, and just have
> that done in the twisted code.
>
> I'm still a little concerned about detecting process lifetimes and exit
> codes (if they matter to twisted), since this process isn't a direct
> child. Should I be trying to convey that information via another channel?

I'm not sure, why would it matter?  It might matter because

1- we want to log the exit code to make sure errors don't go undetected
2- we want to make sure the ssh socket is closed (but presumably that
will just happen through the socket closing)

I think I understand the process model you're using but what do you
mean by " this process isn't a direct child"?

-- 
Martin



Follow ups

References