GLEON / GLM3r

R package for basic GLM model running (version 3.0)
3 stars 15 forks source link

Repeated execution of run_glm causes crash #22

Open rqthomas opened 2 years ago

rqthomas commented 2 years ago

Because of the following code

 Sys.setenv(DYLD_LIBRARY_PATH = paste(system.file("extbin/nixGLM", 
                                        package = packageName()), 
                                   Sys.getenv("DYLD_LIBRARY_PATH"), 
                                 sep = ":"))

the current environment is appended to the DYLD_LIBRARY_PATH. This results in an exponentially increasing environment variable that max out the limit for the environment variable if run_glm is executed repeatedly (as done in data assimilation with FLARE). Is there a need for this code in both the unix and Mac executions? I have removed it and used the following

 dylib_path <- system.file("exec", package = packageName())  

and

                       stderr = NULL, args = system.args, env = paste0("DYLD_LIBRARY_PATH=", dylib_path))

The Mac execution already does this but the Unix did not (so we were crashing on unix FLARE runs). I can do a PR with the fixes if helpful.

jordansread commented 2 years ago

Is this related to #20?

rqthomas commented 2 years ago

I don't think so because the fix in #20 still has the appending

Sys.setenv(LD_LIBRARY_PATH=paste(system.file('extbin/nixGLM', 
                                            package=packageName()), 
                                      Sys.getenv('LD_LIBRARY_PATH'), 
                                      sep = ":"))

the issue I found only occurs if running run_glm 1000s of times and the standard GLM3r use case doesn't involve this