Pluggable monitor fix and refactor #1482
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.
Please check if the PR fulfills these requirements
before creating one)
our contributing guidelines
UPGRADING.md
has been updated with a migration guide (for breaking changes)What kind of change does this PR introduce?
Fixed a race condition in the pluggable monitor client due to a stateLock contention:
Close
) had the stateLock held for the entire scope of the function"port_closed"
message can be received at any moment in the decode loop, and it requires a stateLock as well, but it may be blocked until theClose
function get theclose
message (that may happen later in the decodeLoop)In this case the worst case scenario is that the decode loop is blocked for 10 seconds until the timeout occurs and
Close
exits, but this is not ideal. This bug has been fixed by removing thestate
from the pluggable monitor client, since it's not really useful in any case.titled accordingly?
No
Some other refactorings have been made in the same PR to simplify and make error handling and logging more coherent.