Skip to content
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

(PDB-5696) Allow connection reuse in query monitor #3868

Merged

Conversation

rbrw
Copy link
Contributor

@rbrw rbrw commented Sep 5, 2023

No description provided.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@rbrw rbrw force-pushed the pdb-5696-allow-connection-reuse-in-query-monitor branch from 49eccc2 to 51d3eb9 Compare September 5, 2023 23:37
@rbrw rbrw force-pushed the pdb-5696-allow-connection-reuse-in-query-monitor branch 4 times, most recently from a26c726 to 0932bb2 Compare September 7, 2023 16:33
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
@rbrw rbrw force-pushed the pdb-5696-allow-connection-reuse-in-query-monitor branch from 0932bb2 to 9b986d9 Compare September 7, 2023 19:52
@austb austb marked this pull request as ready for review September 7, 2023 20:26
@austb austb requested review from a team as code owners September 7, 2023 20:26
@austb austb merged commit a825e19 into puppetlabs:main Sep 7, 2023
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants