s-u / Rserve

Fast, flexible and powerful server providing access to R from many languages and systems
http://RForge.net/Rserve
Other
282 stars 65 forks source link

Rserve hangs when control commands enabled in 1.8 and higher #36

Closed ppiotrow closed 1 year ago

ppiotrow commented 9 years ago

Hi, I'm having issue with RServe 1.8 when control commands enabled. It is probably the same what was described in #25 but I created minimal crashing example. The error is that RServe stopped accepting new connections and uses 100% of processor (for ever).

rserve-hangs

I tested that issue occurs on 1.8.1 and 1.8.3 (I'm almost sure that it's also on 1.8.2). After I read your comment from #25 I downgraded to 1.7.3 and everything works.

Im running serve from RScript using

#load libraries so all connections will share them
library(Rserve)
library("yaml")
library("...")
(...)
library("....")

run.Rserve(debug = TRUE, remote = TRUE, control = TRUE, auth = FALSE, fileio = TRUE, maxinbuf=500000, args="--no-save")

Then I'm connecting using Java client with following Scala code

import org.rosuda.REngine.Rserve.RConnection
val host = "10.12.my.rservehost"
val port = 6311
val connToClose = new RConnection(host, port)
val connToSendFile = new RConnection(host, port)
//send file
val serverStream = connToSendFile.createFile("someFile.txt")
serverStream.write("sdkjskjdkasjdkasjkdjskajdksjkajksjd".getBytes)
serverStream.flush()
serverStream.close()
//close
connToSendFile.close()
connToClose.close()
//hang
val connToHang = new RConnection(host, port)

No control commands need to be executed. It is just enough to have opened connection 'A' before you send file via other connection and then close 'A' connection. It sometimes necessary to execute code twice or at most three times

s-u commented 9 years ago

Yes, this is a known issue, control commands are not supported in 1.8. To be precise, in 1.8 the mechanism for communication between the server and the child processes has been completely re-written to allow passing of socket descriptors (e.g., for re-attaching), but that new code is buggy and can cause Rserve to hang. This is the main reason why 1.8 is not released yet. It works fine as long as control commands are disabled.

malcook commented 5 years ago

Hello.

I read in News/Changelog to "notify me so I can assess whether they may be resurrected for the 1.9 series"

Thanks for the warning! Please take the following as such notification...

In linux, I write GNU Makefiles to implement scientific data analysis workflows.

Make allows writing recipes in alternate languages by changing the .SHELL variable from its default (usually sh or bash) on a recipe by recipe basis.

I have contrived a way to change the shell to have recipes evaluated in a running Rserve process.

The process is initialized to source an .Renviron file which in turn sources the CRAN & Bioconductor libraries needed by the recipes of the Makefile, and defines utility functions in terms of them.

This works great for writing Makefiles that embody short snippets of R which in turn have dependencies of large libraries with long load times, etc.

I now intend to write a job which will watch the .Renviron file for changes, and force the Rserve to re-source it when it does change. I will use this feature only during development of my workflow, This will simply my development processes.

I am seeking to understand if the forthcoming absence of control commands will remove my continued ability to deploy such a feature in forthcoming post 1.8 releases, or if there might be a workaround.

Thanks for Rserve!