I've been having a problem related to epoll_ctl() lately.
I have a 3-tier system:

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

The problem is happening in the back tier.
If I kill the middle tier with a control-C and then restart it
(before 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 restart it, the socket descriptor
is 1.

When the socket descriptor is 1, I get an EBADF on
an epoll_ctl with an op of EPOLL_CTL_MOD.
It's not on the first call to epoll_ctl that it fails, but the third
call.  My debugging shows that the epfd and fd are the same
for all three of these calls.

I've tried many things to get the back tier to not give me
the socket descriptor of 1.  I've tried calling daemon(),
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?  Thanks.

-- 
Brian
Ebenezer Enterprises
http://webEbenezer.net

Reply via email to