← Back to team overview

maria-developers team mailing list archive

Re: Repeated Error in accept: Bad file descriptor


Michael Widenius <monty@xxxxxxxxxxxx> writes:

> I didn't know that PBXT would open up all files at startup. If that's

InnoDB actually does something similar during recovery (that is how the
Bug#48929 was originally reported by Peter).

> Paul, can you verify the above is the case for PBXT (ie, that PBXT
> uses one file descriptor per table and don't free these at all?)

Note that it is not a question of if they are freed at all. It is just a
question of how many open files are in use at the time the server allocates
the main socket(s) that it listens on. If this number is too big, the socket
fds get too big for select() to work.

> the case, we should switch to use poll in MariaDB 5.3 ASAP (and
> provide a patch for those that wants it for MariaDB 5.1).

I assume you consider the poll() patch too intrusive for stable 5.1?

But in this case, we should still fix the missing error check in
5.1. Currently, if either of the socket fds is too big, we are getting buffer
overflow in select(), setting arbitrary bits outside of the fd_set buffer.

Something like:

    if (unix_sock >= FD_SETSIZE || base_ip_sock >= FD_SETSIZE ||
        extra_ip_sock >= FD_SETSIZE)
      // Error, refuse to start a server that will be impossible to connect
      // to later.

 - Kristian.