rickhelmus / patRoon

Workflow solutions for mass-spectrometry based non-target analysis.
https://rickhelmus.github.io/patRoon/
GNU General Public License v3.0
58 stars 17 forks source link

Error: graphics device error in Docker #97

Closed LeonSaal closed 5 months ago

LeonSaal commented 5 months ago

Hi Rick,

I am having an issue with visualization using ggplot2 inside the docker container (sha: ce3a9ba9b9ba2ce27a65f1edfe7b02158774bc59292dded927880e24a2082aa5)

Error in RStudioGD() : 
  Shadow graphics device error: r error 4 (Error : C stack usage  7970292 is too close to the limit
)
In addition: There were 50 or more warnings (use warnings() to see the first 50)
> warnings()
Warning messages:
1: In grSoftVersion() :
  unable to load shared object '/usr/local/lib/R/modules//R_X11.so':
  /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0: undefined symbol: g_uri_ref
2: In cairoVersion() :
  unable to load shared object '/usr/local/lib/R/library/grDevices/libs//cairo.so':
  /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0: undefined symbol: g_uri_ref
3: In grDevices:::png("/tmp/Rtmpy56tNu/b5437421b5cd4a63bd3a3c326abfc52a.png",  ... :
  failed to load cairo DLL
4: ...

The same error also occurs when using plotChroms(fGroups), plotInt(fGroups) and plot(fGroups).

Kind regards

Leon

> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: Etc/UTC
tzcode source: system (glibc)

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

other attached packages:
 [1] fstcore_0.9.18  magrittr_2.0.3  lubridate_1.9.3 forcats_1.0.0   stringr_1.5.1   dplyr_1.1.4    
 [7] purrr_1.0.2     readr_2.1.4     tidyr_1.3.0     tibble_3.2.1    ggplot2_3.4.4   tidyverse_2.0.0
[13] patRoon_2.3.1  

loaded via a namespace (and not attached):
 [1] gtable_0.3.4        Biobase_2.62.0      tzdb_0.4.0          vctrs_0.6.5         tools_4.3.2        
 [6] Rdpack_2.6          generics_0.1.3      parallel_4.3.2      fansi_1.0.6         RSQLite_2.3.4      
[11] cluster_2.1.4       blob_1.2.4          pkgconfig_2.0.3     data.table_1.14.10  checkmate_2.3.1    
[16] RColorBrewer_1.1-3  lifecycle_1.0.4     compiler_4.3.2      munsell_0.5.0       codetools_0.2-19   
[21] ncdf4_1.22          fst_0.9.8           httpuv_1.6.13       htmltools_0.5.7     later_1.3.2        
[26] pillar_1.9.0        crayon_1.5.2        ellipsis_0.3.2      cachem_1.0.8        mime_0.12          
[31] tidyselect_1.2.0    digest_0.6.33       stringi_1.8.3       fastmap_1.1.1       grid_4.3.2         
[36] colorspace_2.1-0    cli_3.6.2           utf8_1.2.4          withr_2.5.2         scales_1.3.0       
[41] promises_1.2.1      backports_1.4.1     bit64_4.0.5         timechange_0.2.0    bit_4.0.5          
[46] hms_1.1.3           memoise_2.0.1       shiny_1.8.0         rbibutils_2.2.16    rlang_1.1.2        
[51] Rcpp_1.0.11         xtable_1.8-4        glue_1.6.2          DBI_1.2.0           mzR_2.36.0         
[56] BiocGenerics_0.48.1 rstudioapi_0.15.0   vroom_1.6.5         R6_2.5.1            ProtGenerics_1.34.0
rickhelmus commented 5 months ago

Hi @LeonSaal ,

I just rebuild the Docker images and did a very quick test with ggplot2 and it seems to work again. Can you confirm?

Thanks, Rick

LeonSaal commented 5 months ago

Hi Rick,

thank you for the rebuild. Unfortunately I'm still having the issue. The code I used for testing:

> library(tidyverse)
── Attaching core tidyverse packages ───────────────────────────────────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.4.4     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.0
✔ purrr     1.0.2     
── Conflicts ─────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package to force all conflicts to become errors

> cars = datasets::mtcars

> ggplot(cars, aes(wt, mpg)) + geom_point()
Error in RStudioGD() : 
  Shadow graphics device error: r error 4 (Error : C stack usage  7972308 is too close to the limit
)
In addition: There were 50 or more warnings (use warnings() to see the first 50)

I found this related topic on stackoverflow but I wasn't able to set the ulimit to try if that helps. Inside the container it is:

rstudio@925ab610563c:~$ ulimit -s
8192

Adding the --ulimit stack=16384:16384 option to my docker run command below, resulted in the container not starting at all.

docker run --rm -p 8787:8787 -u 0 -e PASSWORD=none\
 -v $(pwd):/home/rstudio/0_projects\
  -v "${analyses}":/home/rstudio/1_analyses\
   -v ${databases}:/home/rstudio/2_databases\
    -v ${suspects}:/home/rstudio/3_suspects\
     uva-hva.gitlab.host:4567/r.helmus/patroon/patroonrs:latest /init 

Do you have any ideas? It doesn't seem to be an issue with the image, as it works fine for you.

Kind regards,

Leon

> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: Etc/UTC
tzcode source: system (glibc)

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

other attached packages:
 [1] lubridate_1.9.3 forcats_1.0.0   stringr_1.5.1   dplyr_1.1.4     purrr_1.0.2     readr_2.1.5    
 [7] tidyr_1.3.0     tibble_3.2.1    ggplot2_3.4.4   tidyverse_2.0.0

loaded via a namespace (and not attached):
 [1] vctrs_0.6.5       cli_3.6.2         rlang_1.1.3       stringi_1.8.3     generics_0.1.3   
 [6] glue_1.7.0        colorspace_2.1-0  hms_1.1.3         scales_1.3.0      fansi_1.0.6      
[11] grid_4.3.2        munsell_0.5.0     tzdb_0.4.0        lifecycle_1.0.4   compiler_4.3.2   
[16] timechange_0.3.0  pkgconfig_2.0.3   rstudioapi_0.15.0 R6_2.5.1          tidyselect_1.2.0 
[21] utf8_1.2.4        pillar_1.9.0      magrittr_2.0.3    tools_4.3.2       withr_3.0.0      
[26] gtable_0.3.4     
rickhelmus commented 5 months ago

Alright, guess I was a bit to fast with my first attempt. In the end, it was a remainder from issue #93. For me your ggplot2 example is running fine now with the latest image.

LeonSaal commented 5 months ago

Hi Rick,

I kept trying with new builds and now (sha256:c86ac71dee07bf978e5efd14133a7419f21a6cec072aa8e2904185f3c3ab60b7) the error is gone for me as well! Thank you!

Regards,

Leon