Unlock the GIL when destroying DNP3Manager. #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When running pydnp3 I found there was a double-delete on application exit. The root cause of this is the call to the destructor from Shutdown. When Python then cleans up the object the destructor is called again. However, removing the destructor call resulted in a hang. This issue is described in detail at the link below, my solution is borrowed from the comments there.
pybind/pybind11#1446
I did change the ownership of the DNP3Manager from a shared_ptr to a unique_ptr to simplify adding the custom deleter. Since the object is wholely owned by Python anyway, I believe this to be OK.
To reproduce this, run the master_cmd.py script, wait for the command prompt to appear then type 'quit'. Application will terminate with an error.