[R-pkg-devel] New test in R-devel causes existing packages to fail: "Error: connections left open"

Duncan Murdoch murdoch@dunc@n @ending from gm@il@com
Mon Aug 20 02:11:20 CEST 2018

On 19/08/2018 12:34 PM, Gábor Csárdi wrote:
> Sorry, missed that these were examples, so, yeah, that's harder.  G.

How about a function that checks if the connection is open before doing 
anything, and then at the end you close it if it wasn't already open? 
This will make all examples run slower on CRAN, but won't affect most 
users who are doing their own stuff as well as running examples.

Or, how about the startup code for the package opens the connection?

Or perhaps CRAN will respond to this thread with another suggestion.

Duncan Murdoch

> On Sun, Aug 19, 2018 at 6:32 PM Gábor Csárdi <csardi.gabor using gmail.com> wrote:
>> You could just create a function to close the connection and then
>> people could call it at the end of their test suites. >>
>> Gabor
>> On Sun, Aug 19, 2018 at 6:22 PM David B. Dahl <dahl using stat.byu.edu> wrote:
>>> In preparing to submit an update of my package to CRAN, I found that
>>> R-devel has a new test regarding "connects left open" that my packages
>>> fail.  The new test appears to have been committed by Uwe Ligges in
>>> revisions 74959 and 74964 on 2018-07-14 and 2018-07-15, respectively.
>>> The commit message says, "check after each example whether open
>>> connections exist, indicating e.g. file connections were left open or
>>> parallel clusters still running."
>>> I am hoping for advice on how to pass "R CMD check --as-cran".  Or,
>>> perhaps my situation will prompt a change to the test or, at least,
>>> having it result in a warning instead of an error.
>>> Below I describe the situation.  My rscala package allows developers
>>> to write R packages based on Scala (much like rJava and Rcpp for Java
>>> and C++, respectively).  Scala runs as a separate process and
>>> interprocess communication is implemented using socket connections.
>>> Suppose a package using rscala has functions that call Scala code.
>>> (Such packages are 'bamboo', 'sdols', and 'shallot' on CRAN.)  The
>>> first time a user executes an R function calling down into Scala, a
>>> socket connect between Scala and R is established.  For the sake of
>>> low latency, after the call to the function ends, the connection stays
>>> open until the package is unloaded or the R session ends.  But, this
>>> approach runs afoul of the new test mentioned above that appears to be
>>> designed to catch connections that are *accidentally* left open.
>>> I definitely do not want to users of my packages 'bamboo', 'sdols',
>>> and 'shallot' to have to think about managing connection between Scala
>>> and R.  That's an implementation detail and uing the package should be
>>> transparent for the user (who doesn't care about the implementation
>>> details).
>>> On my end, I see two solutions:  1. I could try to reengineer my
>>> approach --- establishing a new connection for every single call into
>>> Scala --- although I am loath to do anything to increase the latency,
>>> or 2. I could wrap all the examples in \donttest so that CRAN checks
>>> are passed.
>>> Or, again, perhaps my situation will prompt a reevaluation of the
>>> test.  Perhaps it could result in a warning (instead of an error) and
>>> the CRAN maintainers would accept packages with such a warning.
>>> Any advise?  Thanks a lot!
>>> -- David
>>> ______________________________________________
>>> R-package-devel using r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

More information about the R-package-devel mailing list