-
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
Execution halted and endpoint stop working when saveWidget() is used #174
Comments
I think what happens here is tmp dir where you save widgets ( What I would do - I would generate html on the fly (for example using |
closing as not active |
I am seeing this error as well. I'm trying to get a minimum reproducible example, but the problem is I can't reproduce it reliably. I have an app that writes some HTML to a folder (created with Could a child process quitting cause R to clean up the tempdir (eg, https://stat.ethz.ch/pipermail/r-devel/2017-February/073748.html)? I'm at my wit's end trying to debug this, due to the fact I can't reliably reproduce it. It just seems to happen randomly. Any tips to help me work out the problem with be appreciated. |
The R temporary directory is not guaranteed to exist beyond the duration of the call, so it cannot be used to keep any content around that should be available after the request finished. If you need to store something, you should use either app directory or app-specific temporary directory (not inside R's temporary space). As Dmitry pointed out, in most cases you want to avoid that and return the full (BTW the original example is gone so it you have a reproducible example, please post it here). Note that lifetime management of results is something you may have to think about a bit. Cleanup is a bit tricky, as you need to know whether the files you created may be needed later or not. How long do you want to guarantee the result of the next |
|
Thanks both for the advice. I wish I had a reproducible example, but it seems to happen randomly. I had assumed that the tempdir() should be around for the whole R session, but it keeps disappearing. So moving the {cachem} dick cache to another place and use a more premanent location for writing (and cleaning up after) is the best option. |
@richarddmorey again, the code you use would be crucial here. The tempdir is around for a session, but for a request a session is only as long as the request, so you'd have to clarify which session you are talking about. One common mistake is to re-use temporary directories between sessions which is not supported, because R will clean it up at exit, so if you share it another session may blow away the contents of a session that is still running. However, without an example I can't look into it. |
@s-u - Unfortunately I can't get it to reproduce reliably, so I can't strip it down to make it minimal. I just know that somehow the tempdir() sometimes gets deleted while RestRserve is running, destroying the cache and interfering with rmarkdown compilation (ie, it can happen between copying files to a temporary subfolder and rendering those files). It's been difficult to debug due to the unreliability. I'm going to work around it for now using directories that R won't delete in place of tempdir(), and I'll come back with the best example I can (if necessary). I'll open a new issue in that case. |
Hi all,
I’m using RestRServe to enable an API that executes certain functions including HTML like leaflets and highcharts following the example at https://github.com/rexyai/RestRserve/blob/master/inst/examples/plot-leaflet/app.R. However, when any of these endpoints is called more than once in a short time period on localhost (double clicks), the following error appears related to the path generated by saveWidget()
Error in (function (..., config.file = "/etc/Rserve.conf") : ignoring SIGPIPE signal Calls: sourceWithProgress ... eval -> eval -> <Anonymous> -> do.call -> <Anonymous> Execution halted {"timestamp":"2021-01-22 16:08:57.014399","level":"ERROR","name":"Application","pid":64379,"msg":"","context":{"request_id":"46c306b6-5ce5-11eb-899f-d037452a2e54","message":{"error":"path[1]=\"/tmp/Rtmp3Ha2xg\": No such file or directory","call":"normalizePath(dirname(file), mustWork = TRUE)","traceback":["FUN(request, response)","saveWidget(m, tmp)",["pandoc_save_markdown(html, file = file, libdir = libdir, background = background, "," title = title)"],"normalizePath(dirname(file), mustWork = TRUE)"]}}}
Then the error 500 appears and all endpoint that uses saveWidget() stop working. I would like to use this API together with a shiny app, for example with a button to change a date that would change an endopint parameter, so a double click in this button will be fatal. Is there any extra configuration to handle this type of html files and avoid saveWidgets?
For reproducible example https://github.com/rexyai/RestRserve/blob/master/inst/examples/plot-leaflet/app.R
Best regards !
The text was updated successfully, but these errors were encountered: