-
Notifications
You must be signed in to change notification settings - Fork 501
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
Handle transient errors #528
Comments
@robinknaapen instead of using APIs from the |
@v-kaywon thanks for your response. If I were to use |
@robinknaapen I apologize I misunderstood the question. I thought transient error only occurs at connection and once you get a stable connection you can do anything with it. As for this feature request, we'll have to figure out how easy/difficult it is to detect a transient state, and also if this feature can be supported (from the documentation you linked, seems like other drivers do not reconnect when a transient error is retrieved). |
@v-kaywon
I think the detection shouldn't be hard, as seen here #418 (comment).
The docs point to examples for PHP and .NET
Other drivers like lib/pq do reconnect on network errors. |
Handling transient errors requires care. If you're doing a read-only query you can just try again, but if you have tried to do an insert or update you won't know whether it succeeded or not before your connection was interrupted by the error. Correct error handling means checking whether the "failed" transaction was successful or not before retrying. I don't see how this could be done in the driver. |
Is your feature request related to a problem? Please describe.
Loadbalancing causes the database connection to shift to a transient state when using Azure SQL Database.
https://docs.microsoft.com/en-us/azure/sql-database/sql-database-connectivity-issues#transient-errors-transient-faults
This causes unhanded/unexpected errors when executing a query
Describe the solution you'd like
Auto reconnecting when a transient state is detected
Describe alternatives you've considered
Writing my own wrapper around the
sql.DB
interface, but this means I have to wrap every function on the interfaceThe text was updated successfully, but these errors were encountered: