-
-
Notifications
You must be signed in to change notification settings - Fork 750
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
fixing subprocess to use system buffer instead of being unbuffered #4803
Conversation
How does this impact the live execution results? |
+1 to @blag I'm wondering too if this change may affect the real-time live output from actions like Performance wise, you may also benefit from disabling "live output" in your environment Lines 25 to 26 in a643ba7
which also takes a lot of CPU cycles. |
@blag At a |
Yeah, IIRC, in the past we've seen some issues with real time output hanging on some distros and that's why we used unbuffered output. I'm fine with this change as long as we document it and make it configurable via config option in st2.conf (e.g. This way users who would potentially have issues can change that value in the config instead of needing to directly edit the code. I can make that change and merge that into master. |
st2common.util.green.shell.run_command() function.
value for "bufsize" argument inside the Python runner run_command function call. For performance reasons, default it to -1, but allow users to change it via config if they are experiencing performance or similar issues.
…ize" argument don't hang or block the Python action runner streaming output functionality.
I pushed the following changes:
We should still keep an eye on potential regressions on other distributions, but I think now that the value can be controlled via config option, it's safe enough to be merged into master. If users experience issues, they can change the config option value to revert back to the old behavior. |
@jdmeyer3^ let me know if you are OK with the changes above. |
This way we can troubleshoot various "fail to start" issues on CI. Without this change, we have no visibility if service fails to start before the actual service starts writting into it's own log file. Sadly we can't rely on new version of screen which supports -Logfile path.log flag so we need to use screen config per screen window so we can use different log files for different processes.
61dd42d
to
0b76bd5
Compare
There were some weird / random Travis test failures. I need to push some debugging changes (0b76bd5) which will hopefully provide us with more information and context which will allow us to troubleshoot such issues in the future. |
@Kami Ya, those changes are fine with me. |
Yay, all green! Thanks again for the contribution. I will go ahead and merge it into master. @jdmeyer3 When you get a chance, can you please test the version / changes from master and confirm it's working as expected? |
While testing large datasets in actions, I came across massive CPU spikes for a relatively small dataset (~8MB) being returned from the action. While investigating the issue I found two problems that were consuming the CPU. The first issue was documented in #4798. The second issue was with how the action was created. When the subprocess is created without the buffer size, it defaults to zero (unbuffered). According to the subprocess docs,
The bufsize can be a discussion whether to use the system default or a large value. After making this change on my local machine I noticed a performance increase minus the MongoEngine issue which still persists.