-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix Windows Ppid Cache Race Condition #962
Conversation
go vet still fails, looking into it |
go vet check passes after changing the mutex to a pointer that is initialized with NewProcess call |
Squashed commits, waiting for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for PR, I didn't yet have a chance to test it. See my comment.
Sorry, #966 makes conflicts. But If you follow the comment and make the changes, this conflicts may resolved, |
Thank you so much! I can reproduce race condition by using this test and this PR can fix.
Could you replace the current |
@shirou test passed on my windows. Added to the commit. |
Problem with your test @shirou is that it doesn't test the same thing anymore (getting a non-zero value, and the same value as And I would also suggest to be explicit that this test is made to detect race conditions (in its name). This test could even be put in a new |
Ah, yes, totally agree to @Lomanic . I'm really sorry but could you revert that commit and create a new |
@Lomanic could you review and merge if deemed sufficient please. |
As per #961, a RWMutex to Process struct and thread-safe ppid access functions are added which are now used for windows but virtually can be used for other OSes in the future.
Another solution would be to not cache at all, but this solution reduces overall system calls and in windows it makes quite the difference.
Please do review. @Lomanic @shirou