Re: [Maria-developers] Repeated Error in accept: Bad file descriptor
Hi!
"Time" == Time Less <timelessness@gmail.com> writes:
I think it is very likely that you are hitting this bug:
Time> Ah, yes, could be. Though my strace was different than this bug shows.
The problem is that MySQL/MariaDB is using select() to accept new connections. But select() has a hard-coded limit of 1024 on the max number of open files it can support. It seems PBXT uses an open file descriptor per table,
Time> Not two per table? It has it looks like many log files, then also a data and Time> index file per table. On my system where I'm trying to use 1,000 tables, I Time> expect about 2,000+[mumble] file handles.
Maybe MariaDB should backport the fix, it is actually a buffer overflow (though it is hard to see how it could be exploitable), but perhaps more relevant it is a rather nasty state for the server to get into, and not really clear how to get it out of it again :-(.
Time> You can't get out of the state again. The server won't accept connections, Time> so you can't drop any tables. You just have to wipe the DB and start over. Time> If PBXT is resilient to its tables disappearing between server restarts, you Time> could rm files from the data directory. I didn't know that PBXT would open up all files at startup. If that's 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). 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?) Regards, Monty
Michael Widenius <monty@askmonty.org> 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.
participants (2)
-
Kristian Nielsen
-
Michael Widenius