AdoNetCore.AseClient icon indicating copy to clipboard operation
AdoNetCore.AseClient copied to clipboard

kernel Cannot read, host process disconnected: {hostname} 1234 spid: 4567

Open thancock14 opened this issue 5 years ago • 3 comments

My sybase admins are reporting a poorly disconnected dbconnection.

I am using Linq2db version 2.9.4 (sybasemanaged provider) AdoNetCore.AseClient 0.16.0 .net core 2.2

I'm opening a connection the same way I did with the .net framework sybase official driver. and I'm disposing of it in a using statement (and passing the connection to linq2db)

the Sybase dba's are simply telling me the disconnect is not happening. So they are getting massive amount of logs or something. I'm seeing zero exceptions on my side, and when I step through the code the connection state is Open before dispose is called and is Closed after calling Dispose()

any suggestions?

thancock14 avatar Sep 16 '20 14:09 thancock14

Hi @thancock14,

One thing to check is connection pooling, which keeps network connections open for reuse in subsequent queries. By default it is enabled, to disable it include Pooling=False; in your connection string.

However, I'd advise keeping pooling enabled -- the performance benefit of not having to re-establish connections is significant

Cheers

senseibaka avatar Sep 17 '20 04:09 senseibaka

Yes, I agree I think the pooling is not something to turn off, but it appears that's not exactly the issue here. It could possibly the tcp keepalive process? Is the disposing of the connection not cleaning up the connection to the database correctly? The dbo's are referring to the issue as a poor Disconnect or the absence of a disconnect. They described the error as the same error that happens when your process dies without cleaning up it's connections with the db. So I'm not seeing any errors client side, but they see errors server side

When I switched back to .net framework 471 and the official sybase driver dll, the server side errors went away. Same connection string and code

thancock14 avatar Sep 22 '20 17:09 thancock14

Ah yes I might have misread the issue.

This driver doesn't send any sort of "close connection"/"logout" kind of message to the server prior to closing the socket, so that might be the cause.

senseibaka avatar Sep 23 '20 01:09 senseibaka