Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal Error when running viewPLP() on Windows #337

Closed
vertfreeber opened this issue Oct 27, 2022 · 5 comments
Closed

Fatal Error when running viewPLP() on Windows #337

vertfreeber opened this issue Oct 27, 2022 · 5 comments

Comments

@vertfreeber
Copy link

Describe the bug
Executing viewPLP() leads to a fatal Error in Rstudio after hanging for a while.

Additional context

Using RStudio on Windows 10. I noticed that in the new Version of PLP (starting from 6.0.0) the Method in viewShinyPlp.r contains the following line(l.133).

Sys.setenv("plpDatabaseSettings" = as.character(ParallelLogger::convertSettingsToJson(databaseSettings)))

In my case the String of the json of my databasesettings is 65 MB(!) big. The main problem here could be that Windows has a character limit on its system variables (See: https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/Sys.setenv under details) Which I think is the reason my rstudio crashes.

Could this be the case? And is there a workaround?

Set up (please run in R "sessionInfo()" and copy the output here):`
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.utf8 LC_CTYPE=German_Germany.utf8 LC_MONETARY=German_Germany.utf8 LC_NUMERIC=C
[5] LC_TIME=German_Germany.utf8

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

other attached packages:
[1] PatientLevelPrediction_6.0.4 FeatureExtraction_3.2.0 Andromeda_0.6.1 dplyr_1.0.10
[5] DatabaseConnector_5.1.0

loaded via a namespace (and not attached):
[1] zip_2.2.1 Rcpp_1.0.9 pillar_1.8.1 compiler_4.2.1 prettyunits_1.1.1 remotes_2.4.2
[7] tools_4.2.1 pkgbuild_1.3.1 bit_4.0.4 jsonlite_1.8.3 RSQLite_2.2.18 memoise_2.0.1
[13] lifecycle_1.0.3 tibble_3.1.8 pkgconfig_2.0.3 rlang_1.0.6 DBI_1.1.3 cli_3.4.1
[19] rstudioapi_0.14 curl_4.3.3 fastmap_1.1.0 rJava_1.0-6 withr_2.5.0 generics_0.1.3
[25] vctrs_0.5.0 hms_1.1.2 rprojroot_2.0.3 bit64_4.0.5 tidyselect_1.2.0 glue_1.6.2
[31] R6_2.5.1 processx_3.7.0 fansi_1.0.3 ParallelLogger_3.0.1 callr_3.7.2 SqlRender_1.10.0
[37] blob_1.2.3 magrittr_2.0.3 ps_1.7.1 ellipsis_0.3.2 assertthat_0.2.1 renv_0.15.5
[43] utf8_1.2.2 cachem_1.0.6 crayon_1.5.2

To Reproduce

plpResult <- loadPlpResult(file.path(getwd(),"singlePlp", "singledemo", "plpResult"))
viewPlp(plpResult)

PLP Log File
Problem is not logged.

@jreps
Copy link
Collaborator

jreps commented Oct 27, 2022

That's super odd as this is the code:
server <- insertRunPlpToSqlite(
runPlp = runPlp,
externalValidatePlp = validatePlp,
diagnosePlp = diagnosePlp
)

connectionDetails <- DatabaseConnector::createConnectionDetails(
dbms = 'sqlite',
server = server
)

databaseSettings <- list(
connectionDetails = connectionDetails,
schema = 'main',
tablePrefix = '',
dbms = 'sqlite',
server = server,
user = NULL,
password = NULL,
port = NULL
)

where server should just be a string specifying where the sqlite location is. databaseSettings should be fairly small, definitely not 65mb. Is it possible to see what's making it such a large character?

@jreps
Copy link
Collaborator

jreps commented Oct 27, 2022

Also, what version of ParallelLogger do you have? Perhaps that function being called is doing something to make the list bigger?

@jreps
Copy link
Collaborator

jreps commented Oct 27, 2022

I just tried locally on my Mac and I see ParallelLogger::convertSettingsToJson is struggling I think due to the connection details object containing environments. I'm not sure why I've not noticed this issue in the past. Let me have a play around to see how to bypass this.

@jreps
Copy link
Collaborator

jreps commented Oct 27, 2022

I've made a fix and just running the package check now. Once it passes, I'll pull in my local changes to the develop branch and then release it.

@vertfreeber
Copy link
Author

Thank you for the quick response! I've already tried the changes, viewPLP runs perfectly on my system now :)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants