in reply to Re: Socket descriptor passed across fork -- hanging
in thread Socket descriptor passed across fork -- hanging
Yeah, I know the line terminators are "wrong" in my server; it's for an existing local protocol with existing clients and servers, so I can't mess with that. So "\n" is "right" for this case, though non-standard.
I see you're going down to the sysread level. That's probably the cleanest solution. I started out using line-mode reads, which was working fine until we uncovered the clients that didn't terminate their last line. Since the value proposition for this server is increasing our flexibility in deploying multiple copies of servers, bundling commands into servers dynamically, and so forth, without having to change and redeploy all the clients, that was kind of a quandry, so I've had to give up line-oriented IO. But because you're using fixed-length packets, you avoid the actual problem that trapped me.
You say in the code that the "next" if accept returns undef isn't necessary any more, but I've seen my $listen->accept() call return EINTR (perl 5.8.8, Linux 2.6.18), so it seems to be necessary still here.
I really appreciate a more sophisticated running example. I've been wondering about things like closing the handles not used after the fork, for example; you seem to think that's worth bothering with.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Socket descriptor passed across fork -- hanging
by Marshall (Canon) on Oct 13, 2011 at 14:28 UTC | |
by dd-b (Pilgrim) on Oct 13, 2011 at 17:47 UTC | |
by Marshall (Canon) on Oct 15, 2011 at 10:28 UTC | |
by Marshall (Canon) on Oct 15, 2011 at 17:26 UTC |