I've been having a problem related to epoll_ctl lately.
You may recall I have a 3-tier system:

1. back tier (tcp server)
2. middle tier (udp server)
3. front tier

If I kill the middle tier with a control-C and then restart it
(without making any requests via the front tier),
the socket descriptor (associated with the middle tier) in
the back tier is 7.  But If I first make some requests via the
front tier, then kill the middle tier and then restart it, the
socket descriptor is 1 instead of 7.

When the socket descriptor is 1, I get an EBADF on
an epoll_ctl with an op of EPOLL_CTL_MOD.
It's on the second call to epoll_ctl though (with
same input) that it fails.  The first one is related
to logging in and the second one is due to the
request via the front tier.  I've tried many things to
get the back tier to not give me the socket descriptor
of 1, but nothing has worked.  I've tried calling
daemon(), I've tried freopen'ing stdin, stdout, and
stderr, and a few other things.  I've tried doing these
things only in the parent, only in the child and in both.
Nothing has worked.  Any ideas?

This problem makes me think more about BSD.  Even if
I figure this out, I'm still left with epoll.   If you could have
any operating system for running an on line service, what
would you pick?  Thanks.

-- 
Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.mn-linux.org/pipermail/tclug-list/attachments/20140714/1b7151cc/attachment.html>