[Tutor] sockets, files, threads

Marilyn Davis marilyn at deliberate.com
Sun Jan 16 03:09:20 CET 2005


Dearest Tutors,

Bah!  It's not over yet.  I don't know why, but again my file
descriptors are being trampled upon now and then.

This time I can see in my log that I'm not trampling on them myself,
like I used to do, unless I'm making calls to the system that I'm not
aware of.

And, first I get this worrisome output:

close failed: [Errno 9] Bad file descriptor
close failed: [Errno 9] Bad file descriptor
close failed: [Errno 9] Bad file descriptor

coming from nowhere.  No traceback, nothing.

I traced this down once to discover that it came out of python *after*
a raise, after a failed call to open a connection to mysql.  In that
particular raise clause, I called my facility to pipe mail to exim,
opening 3 descriptors.  I guessed then that when closing down, it
closes down the pipe descriptors that I had already closed?

So, if it does this, if it closes down descriptors that I've already
closed, it's possible that it's closing down descriptors that have
also already been reopened because I'm running this thing like
lightning?

And the other thought is that there is some other call I make that
uses a file descriptor that I'm not thinking of.  os.listdir?
os.anything?

Any new thoughts?

Marilyn






More information about the Tutor mailing list