-
Notifications
You must be signed in to change notification settings - Fork 0
Freed Memory Safety Improvements (NGWPC-9097) #98
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
base: development
Are you sure you want to change the base?
Conversation
|
So, looking at this again and thinking a bit more deeply about it, I want to make sure that certain testing has been done before we remove the explicit Right now, I actually think the Forcings Engine case will fail, or only succeed by fortunate accident. Looking at There's a difference between the two cases, in that the NetCDF code actually shares the instances of I think the expedient thing to do to nail this down would be to
|
Co-authored-by: Phil Miller - NOAA <[email protected]>
|
Ok, the code looks good to me. The testing we need is to have runs with MPI enabled, more than 1 MPI process, and use of each of the NetCDF forcings provider, and the BMI Forcings Engine provider. Each of those should run to completion and exit without error. |
Use-after-free errors were encountered during the destruction of LSTM python adapters. This PR aims to correct all memory-related problems encountered during those runs.
Removals
NGen.cpphas the explicit call to release the python interpreter lock removed. Do this seemed to make it less likely to free data before running the python BMI finalize functions on freed python objects.Changes
Formulation_Manager::get_forcing_paramsuses astd::unique_ptrfor managing the call toclosedir. This ensures that any openDIR *will be closed regardless of how the function terminates and fixes a use-after-free error when reading properties of adirent *after closing the directory as it's currently written.Bmi_Py_Adapterchecks for whether itsbmi_modelis null before attempting to callFinalize.Testing
Screenshots
Notes
Todos
Checklist
Testing checklist (automated report can be put here)
Target Environment support