-
Notifications
You must be signed in to change notification settings - Fork 5
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
Repeat call of gmse_apply
causes crash
#47
Comments
gmse_apply
causes crashgmse_apply
causes crash
It appears that the problem needs to be solved in C. I think this goes back to me reading in PARAS differently than I have been. I think that if I resolve Issue #46 this will fix this issue too. |
With the commit 26a1d9f7e7180bae4e77b6aa1779baf1554831b7, this issue is now resolved and a new GMSE version has been created. See previous commits leading up to this version to note the changes made to four C files. The bug was caused by a memory management issue in C, where C updated an old vector of parameter values, but it should have been copying the vector and creating a new one. I am now closing the issue. |
The unresolved problem
As discovered by @jeremycusack -- if the function
gmse_apply
is called repeatedly with the sameold_list
, then R will crash. The code below replicates the crash.The problem is a bit perplexing because the crash happens even if
sim2
is removed andgc()
called before running the third line above. The problem also does not occur if alternate functions are run ingmse_apply
, which leads me to believe that the issue is with C. Specifically, it appears that the cause of the crash is related to theresource
function.The reason that the crash occurs is that the
old_list
is somehow modified in the process of runninggmse_apply
. Specifically, thesim$PARAS[33]
is updated to the new resource model. I will figure out how to stop this from happening.A temporary workaround fix
Here is a way to avoid the crash; it should be emphasised that this is really only needed if
gmse_apply
needs to be called with the exact sameold_list
. The crash will not occur if the old list differs among calls togmse_apply
, as typically will occur within a loop where the output is constantly being updated and the newgmse_apply
call pulling results in from the most recent call. The workaround requires copyingsim1
into two separate objects, saving each of those two objects, deleting all three objects, then reloading the two copied objects. Below is a successful example.Now we have successfully created a
sim2
andsim3
run from the sameold_list
. Note that we can recoversim1
by just definingsim1 <- sim1a
.The text was updated successfully, but these errors were encountered: