AWS Aurora "Reading from the stream has failed" Error

We had problem with Aurora SQL throwing error when it is in sleep (pause) mode. By default, it is set to sleep when idle for 5 minutes. After few attempts, we managed to extend the timeout which is command timeout (not to be confused with connection timeout) to 60s in our case to prevent the error from happening. The timeout can be set in connection string:

Server=server;Database=database;Uid=username;Pwd=password;Default Command Timeout=60

Reference:

Update 12/3/2019
The above didn't work somehow on our ASP.NET application that used EntityFramework, so we have to specify it in our ApplicationDbContext constructor and increase it to 5 minutes (300s). The following is the VB.NET version:


Public Sub New(existingConnection As Common.DbConnection, contextOwnsConnection As Boolean)
MyBase.New(existingConnection, contextOwnsConnection)
Database.CommandTimeout = 300
End Sub

Comments

Popular posts from this blog

AWS EC2 Can't Reach EC2 Metadata Service After Subnet Change

A2 Hosting with .NET Core 2.1

Xcode CodeSign Incorrectly States Password is Incorrect