Skip to content

Conversation

@keejon
Copy link

@keejon keejon commented Feb 22, 2024

This fixes an issue in check_version where KeyError is raised if the broker is unavailable or an invalid node_id is used. Instead it will return BrokerNotAvailableError.

This fixes an issue in check_version where KeyError is raised if the broker is unavailable or an invalid node_id is used. Instead it will return BrokerNotAvailableError.
@keejon keejon marked this pull request as ready for review February 23, 2024 07:06
@keejon keejon requested a review from aiven-anton February 23, 2024 07:07
Comment on lines +914 to +915
if not self._maybe_connect(try_node):
raise Errors.BrokerNotAvailableError()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note (non-blocking): This looks correct, and like it should eliminate the chance of a KeyError on the next line.

The _maybe_connect method only returns True if try_node exists in self._conns. I notice there's also locking in that method, indicating there's concurrency and potentially a race condition where the node could be deleted from self._conns with bad timing. I'd be surprised if such a scenario isn't exceedingly rare, and I think this fix is sufficient.

@aiven-anton aiven-anton merged commit d6db6cd into main Feb 23, 2024
@aiven-anton aiven-anton deleted the keejon/bugfix-check-version branch February 23, 2024 10:19
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