-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add more thread safety to output in PerfGraphLive #32014
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
base: next
Are you sure you want to change the base?
Add more thread safety to output in PerfGraphLive #32014
Conversation
|
@lindsayad when you have a moment, please |
|
Job Documentation, step Docs: sync website on 349606b wanted to post the following: View the site here This comment will be updated on new commits. |
|
Job Test, step Results summary on 349606b wanted to post the following: Framework test summaryCompared against 82bb60c in job civet.inl.gov/job/3419953. No change Modules test summaryCompared against 82bb60c in job civet.inl.gov/job/3419953. No change |
|
what exactly is the race condition? |
When it is printing out what to be done, it relies on the state of the buffer (whether or not something else printed). If something else prints to the buffer while it is running, it'll end up clobbering the state of where the status printout is |
|
I don't understand yet. After the libMesh PR, each thread has its own buffer. Things like |
If you could point to this line(s), that would probably help me understand |
Unfortunately it's not that simple. As the perf graph live thread wakes up - it records the state of the console (who printed to it last). How it prints things (like if it is printing a dot because the last thing was a section starting) depends on whether or not it was the last thing to print to the console or not. If something else is printed to console while the print thread wakes up and before it does its print, you get a garbled mess and the print thread could print in the middle of someone elses output. |
|
These changes just feel heavy. It feels disappointing to be introducing a
Garbled as in dots intermingling with other thread's output (which I agree is a problem)? The output should still be atomic, I hope, such that you would not get a race condition of the variety that TSAN reports. Thinking about this makes me wonder why we have a separate thread printing dots anyway since we logically want the output to be sequential |
|
Unless people are intentionally printing console output from code within |
I'm not aware of any way to do this without a thread. |
|
Do you have an example that (usually) demonstrates the issue? |
Closes #32012