I am working to enable downloading big data frame from a shiny app running on Shiny server pro on CentOs 7. I created a download button and I have tried it with a large data frame (more than 500MB). It took about 3 minutes to display the confirmation message (using Firefox). Once I confirmed the download it worked however if canceled, I was disconnected from the server. Looking at the log file I got the following message:
Error: C stack usage 854680375172 is too close to the limit Execution halted
Cancelling download for a small size file did not disconnect from the server. I am thinking to increase the ulimit -s size but I am not sure that is the right solution since I don’t have any recursive calls.
I also worked on another faster solution pre-zipping the data (now 240 MB) however I still have the issue when cancelling the download with Firefox causing a disconnection from the server.
I appreciate your help or any advice to solve my issue.
Here below a reproducible example. I ran on my laptop (mac) and I have no problem when cancelling the download with Firefox or Chrome however doing the same action on the CentOS server with shiny server pro causes a disconnection from the server. Any thoughts?
Thanks.
FE
Example
library(shiny)
ui <- fluidPage(
downloadLink("downloadData", "Download")
)
server <- function(input, output) {
output$downloadData <- downloadHandler(
filename = function() {
paste("data_CCLE-Broad-MIT_xsq_", Sys.Date(), ".zip", sep="")
},
content = function(file) {
myfile = "data_CCLE-Broad-MIT_xsq.zip"
## file size is 244.6 MB
## you can replace this with another big file
if (file.exists(myfile)) file.copy(myfile, file)
}