-
Notifications
You must be signed in to change notification settings - Fork 32
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
Error when transfer is cancelled, leading to tempdir deletion #200
Comments
I just confirmed that this happens on Ubuntu, though I had to be quicker with the CTRL-C because the terminal output was much faster. Session info:
|
@richarddmorey yes, The use of |
If
on connect which will re-create a fresh temporary directory for new connections. Perhaps it could be an option for apps that require it? |
@s-u Thanks - I have written my app defensively to work around this issue, but the problems are
For these reasons, I think this is at least extremely undesirable behaviour, and probably should be thought of as a bug. |
Like I said, I think the most efficient way is to use |
ok, so when you say the on-connect handler do you mean the function that I defined (as an app developer using RestRserve) that handles the request in RestRserve? So every handler would e.g. call unixtools::set.tempdir() first thing (or equivalent code, to prevent a dependency on unixtools), before doing anything else? That seems straightforward. |
Oh, I guess this leaves one question, though - when would all these tempdir()s get cleaned up? Does only the last one defined get cleaned up when R quits? I'm assuming so, otherwise this trick wouldn't work. Is the tradeoff, then, just tempdir()s everywhere, and having to do manual cleanup? |
Describe the bug
Occasionally, RestRserve reports errors:
The RestRserve server continues running, but the tempdir() for the R session has been deleted. Any functions in any package that uses the tempdir will fail. I believe this results from a fork of the R session being cancelled and then cleaning up the tempdir(). I'm not sure, but it seems to result from something happening in Rserve.
The bug has made the development of complex apps difficult, because the disappearance of the tempdir is catastrophic to packages that use scratch space for the session. Even if very persistent storage isn't needed, packages often expect tempdir() to point to an existing directory, and for files not to disappear mid-processing.
This has been reported elsewhere (#174 (comment), s-u/Rserve#121). I only just managed to get a reproducible example, which I provide below.
To Reproduce
The script below defines a simple GET response, which sleeps for 3 seconds (to give some time to react, as in the instructions below; also simulates the generation of the file) then reads a moderately-sized HTML file and serves it.
A zip of the file can be found here index.html.zip - but I don't think the file itself is important just that it is large so slow to print in the terminal (giving you time to cancel it).
Steps to reproduce:
ls
at the terminalcurl
to GET the file:curl "http://localhost:8080/a"
ls
to check the tempdir reported above for the session no longer exists.Expected behavior
No error should appear and the tempdir should not have been deleted.
Environment information
Additional context
The steps to reproduce above work for me every time on MacOS, but I have not had the opportunity to test on a linux distro.
The text was updated successfully, but these errors were encountered: