destroy node on shutdown to avoid hang #124
Merged
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.
fixes #89
At least it fixes the issue on bionic x86_64. I didn't try aarch64 yet, but I believe it's the same issue and so the same fix. If anyone has easy access to aarch64 and could test it, that would be great.
I cannot fully explain the reason for why this is necessary or why it results in the hang. There's more work to be done here (in my opinion) so that this doesn't happen to typical users. There's no reason that I should have to manually destroy the node.
Thanks to @nuclearsandwich for giving me the last hint I needed to find this workaround. We discussed that a potential better solution would be to have shutdown enforce the destruction of all nodes and services before shutdown finishes. That has it's own thread-safety issues and potential for deadlock, but I think that's what needs to happen to avoid this issue.
There might be another solution which address the deadlock directly or at least throws an error rather than deadlocking. I think this because I still cannot explain why this issue doesn't manifest on macOS or Xenial.