Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of file handles left open due to return before closing #556

Closed
sandrotosi opened this issue Dec 8, 2014 · 12 comments
Closed

Lots of file handles left open due to return before closing #556

sandrotosi opened this issue Dec 8, 2014 · 12 comments

Comments

@sandrotosi
Copy link

Hello,
as reported in Debian bug bugs.debian.org/772543 here are several file handles left opened due to the use of return before the handle closure; some have been fixed in 3760d95 but several others are still around (even in that very same commit, the first hunk leave the fd opened.

for programs meant to keep running, leaving fd opened will hit linux limits, like the reported described

Regards,
Sandro

@giampaolo
Copy link
Owner

Many (all?) of those files which were left open should have already been fixed by 7c629de.

@sandrotosi
Copy link
Author

that commit points to a test file changes :)

@giampaolo
Copy link
Owner

Whops! Wrong one. Here: 02d58e9
Before that tests on Python 3 were giving different warnings about unclosed files and now they don't anymore so I suppose this should be fixed already (although no new version including this change is available yet).

@sandrotosi
Copy link
Author

aaah ok I was looking into the possible commit of that issue but was confused by the "remove 2.4/5 compat" name :) cool so any plan to release a new version with those fixes? :)

@giampaolo
Copy link
Owner

It will happen very soon. Closing this out for now.

@sandrotosi
Copy link
Author

@giampaolo hi! dont know if you had a look at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=772543#27 but it seems there are more fd leaks to address?

@giampaolo
Copy link
Owner

Ciao Sandro. What is the method leaking file handles? Process.threads()? I can't see anything wrong with it. Note: I'm talking about the current latest repo version which is not released yet.

@sandrotosi
Copy link
Author

the user attached a patch in the next message, this: https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=32;filename=psutil-filehandle-leaks-more-fixes.patch;att=1;bug=772543 which he mention was under test (still with the version released in debian, 2.1.1) but not come back, but you might still want to give it a look

@giampaolo
Copy link
Owner

Why don't you guys just make a patch for psutil instead? What are the methods leaking fds?

@sandrotosi
Copy link
Author

i'm not making any patch, i'm just passing by the information the reporter wrote on the bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=772543 maybe you can contact him (the email is in the bug report)?

giampaolo added a commit that referenced this issue Jan 3, 2015
@giampaolo
Copy link
Owner

OK, I took a look at the patch and guessed where the problem might be. ad2624a is the result of it: now every open() call uses the 'with' context manager. I suppose all the issues described in that bug report should be addressed now. Could you report back to them asking if they can try latest GIT version and see if the problem still occurs?

@giampaolo giampaolo reopened this Jan 3, 2015
@giampaolo
Copy link
Owner

Fixed in 2.2.0. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants