bpo-33630: Fix race condition in TestPosixSpawn.test_open#7663
bpo-33630: Fix race condition in TestPosixSpawn.test_open#7663pablogsal wants to merge 4 commits into
TestPosixSpawn.test_open#7663Conversation
|
@serhiy-storchaka Do you mind reviewing this? I am not completely happy about the code to wait for the inode to be created but I don't know if I am missing something obviously better. I am referring to this code: max_tries = 3
while not os.path.exists(outfile) and max_tries:
max_tries -= 1
time.sleep(0.1)Note: This code has changed in 28a8ced |
Sorry, something went wrong.
|
There is still a race condition. It is possible that the file is created, but is still empty. Relying on time is not reliable. The child can be paused at any moment. |
Sorry, something went wrong.
|
If the child is paused the |
Sorry, something went wrong.
|
Commit 1ad0a08 handles the situation in which the file is created but nothing is still written into it. |
Sorry, something went wrong.
vstinner
left a comment
There was a problem hiding this comment.
I would prefer to first see the posix_spawn() memory issue fixed, before fixing the Python test.
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
|
@vstinner It seems that the memory corruption is due to a bug in |
Sorry, something went wrong.
|
I have made the requested changes; please review again |
Sorry, something went wrong.
|
Thanks for making the requested changes! @vstinner: please review the changes made to this pull request. |
Sorry, something went wrong.
zhangyangyu
left a comment
There was a problem hiding this comment.
My question is we should use the temp list always or just use it for glibc < 2.20? We could use macros __GLIBC__ and __GLIBC_MINOR__.
Sorry, something went wrong.
|
I can confirm that this PR fixes both bugs. Tested on |
Sorry, something went wrong.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
-
I think the temp list should always be used. This would make code clearer and make testing easier.
-
Make two different PRs for these changes. Changes to the test still don't LGTM.
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
|
@serhiy-storchaka I am going to open another PR for the changes in |
Sorry, something went wrong.
|
Created #7685 for the memory problems. This PR is only for the test race conditions. |
Sorry, something went wrong.
|
I have simplified this bugfix: As far as I understand this won't finish until the inode is created and the data is written to disk: and on the parent Unless I am missing something there is no race condition. When |
Sorry, something went wrong.
|
PPC64 Fedora 3.x, PPC64LE Fedora 3.x, s390x Debian 3.x and s390x RHEL 3.x buildbots are back to green thanks to the commit cb97073, so I don't think that this change is still needed. I close the PR. |
Sorry, something went wrong.
https://bugs.python.org/issue33630
This PR is triying to fix this error (more info in the bpo):