File Closing Problem in 2.3 and 2.4, Not in 2.5

Carroll, Barry Barry.Carroll at psc.com
Mon Jan 8 19:07:58 EST 2007



John:

<<<snip>>
> 
> Hi Barry,
> 
> Please always reply on-list if the communication is non-private -- and
> meaningful :-)

Right. I noticed I hadn't "replied-to-all", so I resent the post to the
mailing list.  Slip of the mouse, no disrespect intended to the list ;^)

> 
> I don't know; here are some things you could check out:
> 
> (1) Windows XP versus *x: The limit on open file handles is 512 in
> Windows XP; write yourself a reference-preserving [hint: append to a
> list] multiple file opener on *x and see how many you get open. I have
> vague recollections of the number 1024 being mentioned.

By rough calculation, we had been through over 500 table invocations
when the error message started showing up.  That fits well enough with
the number of Windows file handles.  I'll check the Linux value.
> 
> (2) Python 2.4 versus 2.5: Read the "what's new" doc, fire up your
> googler, ...

I read through the 2.5 release notes and didn't see anything that looked
related.  I may have been looking for the wrong thing.  I'll check
again.  

> IMHO, the attitude should be to program defensively so that you need
> neither to know nor care about such implementation-specific concerns.
> Operating systems these days give you enough file handles to do any
> reasonable job. It's many moons since MS-DOS 2.n with its max 20 open
> file handles made folks implement LRU caches for file handles.
> 
> Simple rules about unwanted objects include:
> (1) If an object has a free() or close() method, then call it!
> (2) Unbind *all* references to the object.

I tend to agree with you.  I am not the lead programmer on this project,
however, so my preferences do not always get implemented.  This time,
though, as I said, the explicit file close has been retained.  

> Have you checked out my point 2 (holding multiple references to your
> Parser objects)?

Not yet, but I will.  

> 
> Cheers,
> John

Again, thanks.  

Regards,
 
Barry
barry.carroll at psc.com
541-302-1107
________________________
We who cut mere stones must always be envisioning cathedrals.

-Quarry worker's creed





More information about the Python-list mailing list