forked from puppetlabs/puppetdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(PDB-5696) query.monitor: accommodate query socket reuse
Previously, any query a client issued after the first on a given connection might provoke a CancelledKeyException when it tried to register the query/socket/channel with the monitor because the selection key for a given channel for a given selector is unique, and a cancelled key is only cleaned up during the next call to select for the relevant selector. Any attempt to register a channel with a selector between the cancellation of the previous key for that channel and the clean up in the next select will provoke the CancelledKeyException. To address the issue, adjust the registration code to retry whenever it encounters that exception, until it succeeds. While it's retrying, the monitor select loop, which will have been woken up by the previous query's forget, will issue a new select call, removing the canceled key. Fixes: puppetlabs#3866
- Loading branch information
Showing
2 changed files
with
73 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters