-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
get_open_files might hang forever #340
Comments
From g.rodola on November 24, 2012 11:48:21
|
From [email protected] on November 24, 2012 11:52:36
|
From g.rodola on November 24, 2012 12:04:55
|
From [email protected] on November 24, 2012 12:09:07
|
From g.rodola on November 25, 2012 14:38:39
Status: FixedInSVN |
From [email protected] on November 25, 2012 14:42:42
|
From g.rodola on November 25, 2012 14:56:01 Status: ReOpened |
From g.rodola on November 26, 2012 03:22:54
|
From [email protected] on November 26, 2012 12:53:11
|
From g.rodola on November 26, 2012 13:54:30
|
From [email protected] on November 28, 2012 06:17:32
|
From [email protected] on December 12, 2012 19:56:13
|
From g.rodola on December 13, 2012 06:10:05
|
From g.rodola on February 24, 2013 11:49:00
Labels: -Milestone-0.6.2 |
From [email protected] on February 26, 2013 07:54:45
|
From g.rodola on February 27, 2013 06:56:15
|
From g.rodola on March 02, 2013 04:13:54
|
From [email protected] on July 08, 2013 15:37:05
|
From g.rodola on July 09, 2013 04:37:57
|
From [email protected] on July 09, 2013 10:31:43
|
From g.rodola on July 09, 2013 10:38:37
|
From [email protected] on July 09, 2013 11:09:08
|
From g.rodola on July 09, 2013 15:55:42
|
From [email protected] on July 10, 2013 03:10:31
|
From [email protected] on February 28, 2014 10:17:20
|
From g.rodola on February 28, 2014 10:18:48
|
From [email protected] on February 28, 2014 15:05:43
|
From [email protected] on March 03, 2014 11:27:31
Attachment: get_open_files.patch |
From g.rodola on March 03, 2014 11:31:54
Labels: -Priority-Medium Priority-High |
From [email protected] on March 03, 2014 14:21:27
Attachment: get_open_files2.patch |
@daveajones can you please test the pull request in #519? |
I merged the PR #591 into master. Please someone confirm whether the hanging issue is fixed or not. If you have troubles compiling psutil on Windows just ask and I'll send you a pre-compiled binary. |
I'll need a binary to test. I can test today I think. Just can't compile. |
OK, what python version do you need for? 32 or 64 bit? |
64-bit python 3.3.5 |
Test successful. I ran my script before installing your new binary and it hung on the first process enumeration pass. I then installed the patched code you sent and now the script runs fine with no hanging. :-) |
Cool! This was a very long standing issue and I hope it will remain closed for good this time. =) |
Note that as of 15-Oct-2014, it still hangs on Windows XP (and others, I assume) when you run the following python code (hangs at open_files() on the third process it tries in my case):
First I tried it after using pip to install psutil, and I assumed pip had installed a version that did not yet have the fix integrated. So I uninstalled with pip and confirmed it was cleaned up in my site-packages. I then cloned the source from github, confirmed the changes in process_handles.c, and compiled manually to make sure I had this fix. Tried again and the hang-problem persists in Windows (it works fine on *nix). |
I've never been able to reproduce this on Windows XP. What is the process that it hangs on? |
If this bug is confirmed I think I will give up and deprecate and/or remove open_files() functionality on Windows for good, also because it appears this is not possible to do reliably unless a Windows system driver or service is used. |
I think perhaps we should just deprecate it for Windows XP and rewrite the code to use the appropriate non-hanging API calls supported in the newer versions of Windows. Or maintain this hacked up fix and update it as necessary for WinXP. There are only 2 ways to do this on Windows XP without running into the issue: |
I kind of lost track of the previous progress: what are the appropriate non-hanging APIs to use on Windows > XP exactly? If there are such APIs and it is proven that they work (the hanging problem is fixed) it would be perfectly fine to drop this functionality for Windows XP. We're already doing something like that for Process.ionice_get/set which is supported on Windows >= Vista only. Also I suspect the currently "fixed" implementation is skipping some legitimate open files already.
We cannot use a system driver for various reasons. A quick search on the ml led to these posts:
This is not really a solution. |
I agree options 1 and 2 are not good solutions given the context of being a python library. This blog post (http://0memory.blogspot.com/2008/08/getfinalpathnamebyhandle-api-hungs.html) suggests using GetFileInformationByHandleEx (http://msdn.microsoft.com/en-us/library/aa364953(VS.85).aspx) which is introduced in WIndows Vista+ |
Thanks for responding, guys! Jeff, to answer your question I wrote the following test script, which returned the following results before hanging forever on 32-bit Windows XP (I cannot say how it acts on newer versions) (short answer= "BTTray.exe"): output: |
This is now supposed to be fixed by PR #597 which spawns a thread. |
thanks @giampaolo @mrjefftang . much appreciated. |
From original comment:
...here's an archived copy in case that blog disappears: |
I have tried GetFileInformationByHandleEx:
|
From [email protected] on November 24, 2012 15:39:51
Attachment: patch
Original issue: http://code.google.com/p/psutil/issues/detail?id=340
The text was updated successfully, but these errors were encountered: