CDK-R / cdkr

Integrating R and the CDK
https://cdk-r.github.io/cdkr/
42 stars 27 forks source link

InChIKey functionality crashes with "Exception: java.lang.StackOverflowError thrown from the UncaughtExceptionHandler in thread "process reaper"" #139

Open meowcat opened 1 year ago

meowcat commented 1 year ago

I describe the issue here because rinchi is just a wrapper around this functionality, and nothing we can change in rinchi would make a difference to this issue:

library(rcdk)
library(rinchi)
mol <- parse.smiles("CCCC")
rinchi::get.inchi.key(mol[[1]])

results in: Exception: java.lang.StackOverflowError thrown from the UncaughtExceptionHandler in thread "process reaper"

To reproduce:

docker run --rm -it bioconductor/bioconductor_docker:devel
# in the docker
apt-get update
apt-get install openjdk-17-jdk-headless
# same error with built-in jdk11 and with jdk18 and 19
R CMD javareconf
R

in R:

install.packages(c("rcdk", "rJava")) # alternatively from github
install.packages("remotes")
remotes::install_github("CDK-R/rinchi")

Digging into the haystack, I can trigger the error by doing:

jnainchi<- J("io.github.dan2097.jnainchi.JnaInchi") which is used called in CDK here: https://github.com/cdk/cdk/blob/d60aaa15c9c4edb3a0103e6d5a1d8ffacc235435/storage/inchi/src/main/java/org/openscience/cdk/inchi/InChIGenerator.java#L537

System (please complete the following information):

Interestingly, I do not have the error on R 4.2.0, rJava 1.0-6, rcdk 3.7.0, rcdklibs 2.8 on Windows.


 setting  value
 version  R Under development (unstable) (2023-01-10 r83596)
 os       Ubuntu 22.04.1 LTS
 system   x86_64, linux-gnu
 ui       X11
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Etc/UTC
 date     2023-01-13
 pandoc   2.19.2 @ /usr/local/bin/pandoc

 package     * version date (UTC) lib source
 cli           3.6.0   2023-01-09 [1] CRAN (R 4.3.0)
 fingerprint   3.5.7   2018-01-07 [1] CRAN (R 4.3.0)
 iterators     1.0.14  2022-02-05 [1] CRAN (R 4.3.0)
 itertools     0.1-3   2014-03-12 [1] CRAN (R 4.3.0)
 png           0.1-8   2022-11-29 [1] CRAN (R 4.3.0)
 rcdk        * 3.7.0   2023-01-13 [1] Github (CDK-R/cdkr@95f7e23)
 rcdklibs    * 2.8     2023-01-13 [1] Github (CDK-R/rcdklibs@55dbd00)
 rinchi      * 0.5     2023-01-13 [1] Github (CDK-R/rinchi@f1a61f5)
 rJava       * 1.0-6   2021-12-10 [1] CRAN (R 4.3.0)
 sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.3.0)

 [1] /usr/local/lib/R/site-library
 [2] /usr/local/lib/R/library

Additional context Add any other context about the problem here.

meowcat commented 1 year ago

Same problem with R 4.2.2 from bioconductor/bioconductor_docker:RELEASE_3_16

meowcat commented 1 year ago

Tested on two completely different machines

meowcat commented 1 year ago

Same problem with R 4.2.1 from bioconductor/bioconductor_docker:RELEASE_3_15

meowcat commented 1 year ago

Note: this issue arose with rcdklibs 2.8 Provisional workaround:

remotes::install_github("CDK-R/rcdklibs@c1f2d125cb00e09c8aac815107b54fe1ef8ebe8f")
remotes::install_github("CDK-R/cdkr/rcdk@cef1eed1555947ed82e8303cb6d79c77fd89b3c1")
zachcp commented 1 year ago

Hmmm. Works fine for me. Not sure whats happening.

library(rcdk)
library(rinchi)

mol <- parse.smiles("CCCC")
rinchi::get.inchi.key(mol[[1]])
[1] "IJDNQMDRQITEOD-UHFFFAOYSA-N"

> .jcall("java/lang/System", "S", "getProperty", "java.runtime.version")
[1] "17.0.6+10-jvmci-22.3-b13"
meowcat commented 1 year ago

Are you on Windows? Linux? For me this happens on Linux, as shown above.