dotnet / dotnet/SqlClient

Consider handling error code 40613 with stretched timeout with default retry logic provider

Open
#1,957 6 comments 2 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
989
Forks
340
Avg merge
4d 19h
Merged PRs (30d)
72

Description

### Describe the bug
When connecting to a serverless database, it's reasonable to receive error code 40613 as the database resumes. But resuming can take as long as ~45 seconds, in which case driver generally times out even with the default Retry logic provider.

```
Exception message: SqlError.ctor | ERR | Info Number 40613, Error State 1, Error Class 20,
Error Message 'Database '<>' on server '<>.database.windows.net' is not currently available. 
Please retry the connection later. 
```

### To reproduce
Connect to a serverless database when it's paused.

### Proposal
Since the driver receives the error code with the default retry logic provider, the driver could provide a log (Waiting for database to resume) and retry connection after some time (additional 30 seconds delay) - so it can resume and successfully connect in the next connection attempt.

Most users would like to not have to worry about this use case, even if it takes a bit longer to wait for database to resume.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.