You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rstudio/docker v1.2.0 image
R version 4.3.2 (2023-10-31) -- "Eye Holes"
Platform: x86_64-pc-linux-gnu (64-bit)
Deployment: nginx / HAProxy 1.6.7
Problem description
In the specific application a zip file is uploaded to the server. The zip file is unzipped and then after some processing another zip file is produced and gets returned in the response. If the endpoint receives a request while it's working, the R application freezes and produces the following output, for any request to any other endpoint of plumber.R.
After some tests, we ascertained that this happens only when the Plumber application is deployed for load balancing through nginx and HAProxy 1.6.7 (according to https://www.rplumber.io/articles/hosting.html)
Error in file(open = "w+b", encoding = "UTF-8") :
cannot open the connection
Calls: -> file
In addition: Warning message:
In file(open = "w+b", encoding = "UTF-8") :
cannot open file '/tmp/Rtmpa4GHwN/Rf17deb5ac8': No such file or directory [the exact path changes with every request]
*@paramf:file#* @post /meditsrome2function(f, res) {
receivedzip<- tempfile()
writeBin(f[[1]], receivedzip, useBytes=TRUE)
final_data<-list("vector")
list_of_csvs<-utils::unzip(receivedzip,list=TRUE)[,1]
for (iin1:length(list_of_csvs)) {
conn<- unz(receivedzip, list_of_csvs[i])
final_data[[i]] <- read.table(conn, sep=",",header=T)
}
unlink(receivedzip)
tmp<- paste0("/home/data/", stringi::stri_rand_strings(1, 7, pattern="[A-Za-z0-9]"))
while (file.exists(tmp)) {
tmp<- paste0("/home/data/", stringi::stri_rand_strings(1, 7, pattern="[A-Za-z0-9]"))
}
dir.create(tmp)
dir.create(file.path(tmp, "wd"))
wd<- file.path(tmp, "wd")
zipfile<- paste0("/home/data/", stringi::stri_rand_strings(1, 10, pattern="[A-Za-z0-9]"), ".zip")
while (file.exists(zipfile)) {
zipfile<- paste0("/home/data/", stringi::stri_rand_strings(1, 10, pattern="[A-Za-z0-9]"), ".zip")
}
ta<-final_data[[1]]
tb<-final_data[[2]]
tc<-final_data[[3]]
# Processing which produces a number of files within the directory "wd" / code omittedzip::zip(zipfile, "wd", root=tmp)
unlink(wd, recursive=TRUE)
val<- readBin(zipfile, "raw", n=file.info(zipfile)$size)
unlink(zipfile)
as_attachment(val, "results.zip")
}
Error code
Error in file(open = "w+b", encoding = "UTF-8") :
cannot open the connection
Calls: -> file
In addition: Warning message:
In file(open = "w+b", encoding = "UTF-8") :
cannot open file '/tmp/Rtmpa4GHwN/Rf17deb5ac8': No such file or directory
The content you are editing has changed. Please copy your edits and refresh the page.
System details
Problem description
In the specific application a zip file is uploaded to the server. The zip file is unzipped and then after some processing another zip file is produced and gets returned in the response. If the endpoint receives a request while it's working, the R application freezes and produces the following output, for any request to any other endpoint of plumber.R.
After some tests, we ascertained that this happens only when the Plumber application is deployed for load balancing through nginx and HAProxy 1.6.7 (according to https://www.rplumber.io/articles/hosting.html)
Error in file(open = "w+b", encoding = "UTF-8") :
cannot open the connection
Calls: -> file
In addition: Warning message:
In file(open = "w+b", encoding = "UTF-8") :
cannot open file '/tmp/Rtmpa4GHwN/Rf17deb5ac8': No such file or directory [the exact path changes with every request]
Error code
Tasks
The text was updated successfully, but these errors were encountered: