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

Better handling of PoolClearedError during legacy read #13

Closed
wants to merge 2 commits into from

Conversation

felixmo
Copy link

@felixmo felixmo commented Jun 13, 2024

Based on https://github.com/braze-inc/mongo-ruby-driver/blob/deployed-in-platform/spec/integration/retryable_reads_errors_spec.rb#L76 it looks like PoolClearedError can be retried on reads.

Also updates #legacy_read_with_retry? to check whether the error responds to #retryable? before attempting to call it.

@felixmo felixmo requested a review from a team June 13, 2024 15:32
@@ -218,7 +218,7 @@ def legacy_read_with_retry(session, server_selector, &block)

if is_retryable_exception?(e)
raise e if attempt > client.max_read_retries || session&.in_transaction?
elsif e.retryable? && !session&.in_transaction?
elsif e.respond_to?(:retryable?) && e.retryable? && !session&.in_transaction?
Copy link

@joelim41 joelim41 Jun 13, 2024

Choose a reason for hiding this comment

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

should we match the new method modern_read_with_retry way of handling these new errors instead? e.g. handle write_retryable errors here

Copy link
Author

Choose a reason for hiding this comment

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

I tried that initially but saw some legit test failures so I think that might be changing the behavior of this too much

@@ -58,7 +58,8 @@ def retryable_exceptions
Error::ConnectionPerished,
Error::ServerNotUsable,
Error::SocketError,
Error::SocketTimeoutError
Error::SocketTimeoutError,
Error::PoolClearedError,

Choose a reason for hiding this comment

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

might want to add the other PoolErrors here

@jasonpenny
Copy link

I don't feel confident that any of us know this code well enough to be patching this in a rush.

I think we ought to open a PR upstream and to get more perspective from the maintainers

@felixmo felixmo closed this Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants