-
Notifications
You must be signed in to change notification settings - Fork 65
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
Closing the socket client-side results in SIGPIPE, R shutdown which removes the tempdir #100
Comments
Based on strace of my application, this always happens in the same method:
|
It's not possible to set the There are two options
|
I'll see if there is a way to insert a handler before R shutdown so that we can set the tempdir to |
Thanks for the comments. I do not understand how RServe can go from a SIGPIPE in the Rserve code, to R_CleanTempDir in the main loop of R. Is this libunwind/strace that makes an error, or did I fail to understand something?
|
After testing:
The right way to solve this, in my humble opinion, is to set R_ignore_SIGPIPE on any internal code that is using send() and recvfrom(). See also
See also the example of the internal HTTP server within R |
…eceiving EPIPE This solution is intended to solve issue s-u#100. The method is very similar to what is being done in the internal R http server (see Rhttpd.c). It should therefore not cause any issues in other parts of R.
I did some tests with the new code. When receiving a SIGPIPE now, the following happens:
The child now gracefully shuts down, as it nicely detects the socket was closed. |
When I connect to RServe on Linux using 5 client-side connections
And I close the 3rd one forcefully (socket.close() in Java)
Then R receives SIGPIPE
And the R tempdir is removed (R_CleanTempDir is called)
RServe should set its own signal handler for R_SIGPIPE, and fail gracefully.
Still trying to build a nice example, but it is difficult to pinpoint the exact cause of SIGPIPE.
The text was updated successfully, but these errors were encountered: