-
Notifications
You must be signed in to change notification settings - Fork 141
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
test_in_toto_run_with_byproduct test fails sporadically #282
test_in_toto_run_with_byproduct test fails sporadically #282
Comments
…ck-error Add logging to help debug #282
Unsurprisingly this bug is due to a race condition in the Lines 194 to 212 in a481e47
The subprocess might write something to its stdout/stderr files after the last read from the parent, but exit before the next read. The original author of that feature had an additional post-loop read probably for that reason, which didn't survive the port, when the PR was taken over. (IIRC the So, assuming that the last write to a stdout/stderr file happens before the process exits, than a post-loop read (or maybe a do-until loop) should fix this issue. Otherwise, if the process can exit before the data becomes available, solving will be more complex. Apart from above, we should probably also add back the comments from the original author regarding buffered outputs. from in_toto import process as pr
pr.run_duplicate_streams("python -c 'from time import sleep; print(\"now\"); sleep(3); print(\"3 secs later\"); sleep(2)'", timeout=10)
pr.run_duplicate_streams("python -c 'from time import sleep; print(\"now\", flush=True); sleep(3); print(\"3 secs later\", flush=True); sleep(2)'", timeout=10) |
Also, |
Confirming that one extra loop to read after the process exits does the trick. :) |
This issue will be fixed in secure-systems-lab/securesystemslib#186. Instead of duplicating the fix, we should update in-toto to use |
Description of issue or feature request:
I've see recently seen these appear sporadically on different Python versions.
Current behavior:
AssertionError: False is not true
)Expected behavior:
self.assertTrue(<expr>, <message>)
)The text was updated successfully, but these errors were encountered: