[Tutor] sockets, files, threads

Marilyn Davis marilyn at deliberate.com
Sun Jan 16 06:43:42 CET 2005


p.p.s.

I have only wrapped my lock around file-descriptor creations.  Should
I wrap it around closings too?  Or the whole open -> close
transaction?  It sounds like error-prone work to do the latter.  What
am I missing?

What should I be reading to get a better clue?

I'll do some googling.

Thank you.

On Sat, 15 Jan 2005, Marilyn Davis wrote:

> 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
> 
> 
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 

-- 




More information about the Tutor mailing list