← Back to team overview

maria-developers team mailing list archive

Re: Repeated Error in accept: Bad file descriptor


Hi All,

Yes, PBXT uses a lot of file handles: generally 3 per table. It opens all tables before recovery. Unfortunately, I have not worked on optimizing this behavior.

Although the only reason for this is to resolve possible FK/PK relationships. So I think this should be considered a PBXT bug, and the problem should be fixed.

Anyway this will certainly be the problem in this case. As Kristian says, select() is severely limited in that it only works with the low numbered file handles.

To get the server up and running again you can just delete the tables manually (the table files: .frm, .xtd, .xtr, .xti), when MySQL is not running. PBXT will complain on startup, but should recover anyway.

Best regards,


On Jul 15, 2010, at 9:48 AM, Michael Widenius wrote:


"Time" == Time Less <timelessness@xxxxxxxxx> 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
open files it can support. It seems PBXT uses an open file descriptor per

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
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?)


Mailing list: https://launchpad.net/~maria-developers
Post to     : maria-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp