Re: [Python-Dev] Internal counter to debug leaking file descriptors

2010-09-03 Thread anatoly techtonik
On Tue, Aug 31, 2010 at 5:03 PM, Guido van Rossum gu...@python.org wrote: If you wanted to do something like this in the Python stdlib, you'd have to monkey-patch (with a proxy/wrapper) all places that can open or close a filedescriptor -- os.open, os.popen, os.close, file open/close, socket

Re: [Python-Dev] Internal counter to debug leaking file descriptors

2010-09-03 Thread Giampaolo Rodolà
Of course it would be nice to get access to FD stack so that a full filename can also be retrieved in this case. On Linux, this can be easily achieved by using /proc. You can take a look at how this is done in the current development version of psutil:

Re: [Python-Dev] Internal counter to debug leaking file descriptors

2010-09-03 Thread Terry Reedy
On 9/3/2010 6:09 AM, Giampaolo Rodolà wrote: Of course it would be nice to get access to FD stack so that a full filename can also be retrieved in this case. On Linux, this can be easily achieved by using /proc. You can take a look at how this is done in the current development version of

Re: [Python-Dev] Internal counter to debug leaking file descriptors

2010-09-03 Thread Giampaolo Rodolà
The Windows part slipped under my radar. =) Unfortunately the Windows binaries still refer to the current version which doesn't include open files and open connections functionalities. To have those he'll have to get the latest code from svn and compile it with mingw32. --- Giampaolo

[Python-Dev] Internal counter to debug leaking file descriptors

2010-08-31 Thread anatoly techtonik
Hi, Is there any kind of internal file descriptor counter that can be queried to debug issues with leaking resources? It can be used in tests to check that all tests are finish with 0 opened descriptors. It will be very useful while porting Python applications from Unix to Windows. Unix is more

Re: [Python-Dev] Internal counter to debug leaking file descriptors

2010-08-31 Thread Guido van Rossum
If you wanted to do something like this in the Python stdlib, you'd have to monkey-patch (with a proxy/wrapper) all places that can open or close a filedescriptor -- os.open, os.popen, os.close, file open/close, socket open/close, and probably a bunch more that I've forgotten. Also some extension

Re: [Python-Dev] Internal counter to debug leaking file descriptors

2010-08-31 Thread Glyph Lefkowitz
On Aug 31, 2010, at 10:03 AM, Guido van Rossum wrote: On Linux you can look somewhere in /proc, but I don't know that it would help you find where a file was opened. /dev/fd is actually a somewhat portable way of getting this information. I don't think it's part of a standard, but on Linux

Re: [Python-Dev] Internal counter to debug leaking file descriptors

2010-08-31 Thread exarkun
On 05:22 pm, gl...@twistedmatrix.com wrote: On Aug 31, 2010, at 10:03 AM, Guido van Rossum wrote: On Linux you can look somewhere in /proc, but I don't know that it would help you find where a file was opened. /dev/fd is actually a somewhat portable way of getting this information. I don't

Re: [Python-Dev] Internal counter to debug leaking file descriptors

2010-08-31 Thread David Malcolm
On Tue, 2010-08-31 at 17:40 +, exar...@twistedmatrix.com wrote: On 05:22 pm, gl...@twistedmatrix.com wrote: On Aug 31, 2010, at 10:03 AM, Guido van Rossum wrote: On Linux you can look somewhere in /proc, but I don't know that it would help you find where a file was opened. /dev/fd is