Skip to content
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

flush stderr/stdout from background processx to avoid blocking #345

Merged
merged 3 commits into from
Apr 27, 2023

Conversation

ivokwee
Copy link
Member

@ivokwee ivokwee commented Apr 27, 2023

Sometimes the background process seems to halt or blocked. I suspect blocking of stderr/stdout is happening as described here https://processx.r-lib.org/

Note, that the connections have a buffer, which can fill up, if R does not read out the output, and then the process will stop, until R reads the connection and the buffer is freed.
Always make sure that you read out the standard output and/or error of the pipes, otherwise the background process will stop running!

So during process checking we need to flush the stderr/stdout buffer to avoid any fill up. I changed the code.

@ivokwee ivokwee requested a review from mauromiguelm April 27, 2023 01:15
@ivokwee ivokwee added the bug Something isn't working label Apr 27, 2023
@ivokwee ivokwee self-assigned this Apr 27, 2023
Copy link
Contributor

@mauromiguelm mauromiguelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • tested on wsl, did not block the app as before.
  • added a small comment about computation of multiple datasets
  • recommend storing the process directly on lists, and not on intermediate variable, as I tried this solution before and it did not work for multiple processess.

@ivokwee ivokwee merged commit d76501e into master Apr 27, 2023
@ivokwee ivokwee deleted the processx-stderrout branch April 27, 2023 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants