-
Notifications
You must be signed in to change notification settings - Fork 511
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
Connection reset if server sits idle. #44
Comments
Thanks Matt, Driver currently doesn't have any keep alive, that is something that needs to be implemented. Here is one idea: http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html |
Here is relevant TDS specification: http://msdn.microsoft.com/en-us/library/dd341108.aspx |
I'll take a look at that. Thanks! |
The database/sql package retries automatically the operation if the driver returns ErrBadConn. |
io.EOF is only returned if SQL server called close on connection, in other cases, e.g. when connection was dropped by router, you will get ECONNRESET. Probably any error from transport layer should result in ErrBadConn. |
Have you been able to make a fix for this yet? I want to make sure before I start working on it. |
No, I didn't do anything yet, you can work on it if you want. |
@MattAitchison can you test with branch badconn? |
That does seem like it's working better. After I disconnect and reconnect the network from my SQL sever the first query returns with EOF but the next query returns data. |
If the EOF is after a Scan or Next the driver cannot do anything about it, only the application code can recover such errors by retrying the transaction. |
@MattAitchison a new parameter that enables keep alive is added, that might solve the original issue "Connection reset if server sits idle". |
Get default URL from environment variable MIGRATE_URL
If my application doesn't periodically send queries to the DB my connection gets dropped.
Here is the error from Go.
The text was updated successfully, but these errors were encountered: