NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.51k stars 13.69k forks source link

Errors when loading RCDT provided by rPackages.RCDT #344213

Open HVinther opened 13 hours ago

HVinther commented 13 hours ago

Describe the bug

The R package RCDT does not load properly. In a terminal R session, the package unexpectedly provides a prompt, when attempting to load the package with library("RCDT"). Entering a string just gives a new prompt. Entering an integer gives a segmentation fault.

When attempting the same inside the console of the ide positron, the package does load and is useable, but it gives a warning about the author string.

When trying to load the package using callr (used in pipeline tools such as targets), the call errors out and also gives the warning message described above.

The three scenarios can be seen in the screenshots.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Create temporary enviroment nix-shell -p R rPackages.callr rPackages.RCDT
  2. Enter an R session R
  3. Call library("RCDT")

Alternatively

  1. Create temporary enviroment nix-shell -p R rPackages.callr rPackages.RCDT
  2. Enter the ide Positron
  3. Call library("RCDT") in the console

Alternatively

  1. Create temporary enviroment nix-shell -p R rPackages.callr rPackages.RCDT
  2. Enter the ide Positron
  3. Call callr::r(\(x){version},package = "RCDT") in the console

Expected behavior

Package loads with no errors or warnings. Expected behaviour can be seen by installing the docker image rocker/r2u and then installing RCDT and callr inside the image using install.packages.

Screenshots

In terminal session: image

In positron ide: image

Using with callr in positron ide: image

Additional context

Issue originally discovered when using the {rix} for R and thus reported in (https://github.com/ropensci/rix/issues/329#issue-2545276361) but found to persist using just nix.

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.10.11-1-default, openSUSE Tumbleweed, noversion, nobuild`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.24.1`
 - nixpkgs: `/home/hvl/.nix-defexpr/channels/nixpkgs`

Add a :+1: reaction to issues you find important.

b-rodrigues commented 7 hours ago

I can indeed reproduce. Also I tried with RStudio using

nix-shell -p "rstudioWrapper.override{packages = with rPackages; [ RCDT ];}"

and trying to load RCDT in RStudio makes it crash. But I don't get anything about the author names and such.

Kupac commented 6 hours ago

Can't reproduce on x86_64-linux. I could run the first example from the vignette just fine. Could it be an mac issue?

> sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: x86_64-pc-linux-gnu
Running under: NixOS 24.11 (Vicuna)

Matrix products: default
BLAS/LAPACK: /nix/store/bgl9cw31jlh61vq5mabpzf62lqc5bv31-blas-3/lib/libblas.so.3;  LAPACK version 3.12.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=hu_HU.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=hu_HU.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=hu_HU.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=hu_HU.UTF-8 LC_IDENTIFICATION=C       

time zone: Europe/Brussels
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RCDT_1.3.0

loaded via a namespace (and not attached):
 [1] digest_0.6.36        rgl_1.3.1            R6_2.5.1            
 [4] base64enc_0.1-3      fastmap_1.2.0        xfun_0.47           
 [7] gtools_3.9.5         magrittr_2.0.3       KernSmooth_2.23-24  
[10] knitr_1.48           htmltools_0.5.8.1    cli_3.6.3           
[13] bitops_1.0-8         scatterplot3d_0.3-44 caTools_1.18.2      
[16] Rvcg_0.23            colorsGen_1.0.0      Polychrome_1.5.1    
[19] compiler_4.4.1       tools_4.4.1          Rcpp_1.0.13         
[22] gplots_3.1.3.1       colorspace_2.1-1     jsonlite_1.8.8      
[25] rlang_1.1.4          htmlwidgets_1.6.4   
b-rodrigues commented 6 hours ago

I'm on opensuse and so is OP, but you're on NixOs, right? could this be related to some graphics issue?

jbedo commented 6 hours ago

That prompt is the standard R signal handler that gets triggered on a SIGSEGV, e.g.,:

> dyn.load("/nix/store/3dyw8dzj9ab4m8hv5dpyx7zii8d0w6fi-glibc-2.39-52/lib/libc.so.6")
> .Call("raise","SIGSEGV")

 *** caught segfault ***
address 0x100000002, cause 'memory not mapped'

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:

No idea why it's not showing the full message though. Likely the package has memory errors which are triggering a segfault on load.

I also couldn't reproduce the error, same sessionInfo() as Kupac. I further verified with valgrind that there are no memory errors occuring on load. I suggest verifying the issue exists with --pure as this seems likely to be a side effect.

jbedo commented 5 hours ago

Posting your sessionInfo() would also be helpful.