[tpop3d-discuss]Re: bad file descriptor from select in tpop3d

Arkadiusz Miskiewicz arekm at pld-linux.org
Thu, 1 Jun 2006 09:38:31 +0200


>On Wed, May 31, 2006 at 04:06:07PM +0200, Daniel Tiefnig wrote:
>> Arkadiusz Miskiewicz wrote:
>> > Under heavy load I'm getting Bad file descriptor from select.  Any
>> > ideas why it's bad here?
>>=20
>> >From the values of the descriptors ("1024 1025 1026 1027 ..." in the
>> select call) I'd guess your "open files" limit is set to 1024, and
>> you're just running out of file descriptors. Try increasing the max.
>> number of open files for tpop3d.

My limit for descriptors is set to 32768 before starting tpop3d.

>more likely the maximum number of fds in an FD_SET, I
>think -- if the process had run out of fds then accept
>would be returning -1 -- out-of-range file descriptors
>oughtn't to get as far as select.
>
>If that is the problem, of course, some more thought is
>needed -- it might be necessary to replace select with
>poll, or add more threads which can each call select.
Implementing epoll support would be nicer since it's considered to be best=
=20
one.

Would replacing select code in tpop3d with libevent [1] usage be acceptable?

libevent can use select, poll, epoll and kqueue (on bsd) depending on which=
 is=20
available.

>> In bash, that would be (e.g.): ulimit -n 4096
>> And after that (within the same or a child-shell) start tpop3d.
>>=20
>> > The worse thing is that it doesn't recover from such problem.
>>=20
>> Hmmm, it should when load decreases, I think...
Maybe but until that happens I get tons of ,, Bad file descriptor'' errors =
in=20
logs + the problem is that when customers get errors from pop3 server they=
=20
retry and increase load even more :)

1. http://www.monkey.org/~provos/libevent/
=2D-=20
Arkadiusz Mi=B6kiewicz        PLD/Linux Team
arekm / maven.pl            http://ftp.pld-linux.org/