Skip to content
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

SNOW-1942008: Connection reset is not handled #1101

Open
gdoron opened this issue Feb 20, 2025 · 1 comment
Open

SNOW-1942008: Connection reset is not handled #1101

gdoron opened this issue Feb 20, 2025 · 1 comment
Assignees
Labels
bug status-information_needed Additional information is required from the reporter status-triage Issue is under initial triage

Comments

@gdoron
Copy link

gdoron commented Feb 20, 2025

|System.Net.Http.HttpRequestException: Error while copying content to a stream.
---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer.
---> System.Net.Sockets.SocketException (104): Connection reset by peer
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.CreateException(SocketError error, Boolean forAsyncThrow)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ReceiveAsync(Socket socket, CancellationToken cancellationToken)
at System.Net.Sockets.NetworkStream.ReadAsync(Memory1 buffer, CancellationToken cancellationToken) at System.Net.Security.SslStream.EnsureFullTlsFrameAsync[TIOAdapter](CancellationToken cancellationToken, Int32 estimatedSize) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Net.Sockets.SocketAsyncEventArgs.TransferCompletionCallbackCore(Int32 bytesTransferred, Memory1 socketAddress, SocketFlags receivedFlags, SocketError socketError)
at System.Net.Sockets.SocketAsyncEngine.System.Threading.IThreadPoolWorkItem.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
--- End of stack trace from previous location ---

--- End of inner exception stack trace ---
at System.Net.Security.SslStream.EnsureFullTlsFrameAsync[TIOAdapter](CancellationToken cancellationToken, Int32 estimatedSize)
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](Memory1 buffer, CancellationToken cancellationToken) at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token) at System.Net.Http.HttpConnection.FillAsync(Boolean async) at System.Net.Http.HttpConnection.ChunkedEncodingReadStream.CopyToAsyncCore(Stream destination, CancellationToken cancellationToken) at System.IO.Compression.DeflateStream.CopyToStream.CopyFromSourceToDestinationAsync() at System.Net.Http.DecompressionHandler.DecompressedContent.SerializeToStreamAsync(Stream stream, TransportContext context, CancellationToken cancellationToken) at System.Net.Http.HttpContent.LoadIntoBufferAsyncCore(Task serializeToStreamTask, MemoryStream tempBuffer) --- End of inner exception stack trace --- at System.Net.Http.HttpContent.LoadIntoBufferAsyncCore(Task serializeToStreamTask, MemoryStream tempBuffer) at System.Net.Http.HttpContent.WaitAndReturnAsync[TState,TResult](Task waitTask, TState state, Func2 returnFunc)
at Snowflake.Data.Core.RestRequester.PostAsync[T](IRestRequest request, CancellationToken cancellationToken)
at Snowflake.Data.Core.SFStatement.ExecuteAsync(Int32 timeout, String sql, Dictionary`2 bindings, Boolean describeOnly, Boolean asyncExec, CancellationToken cancellationToken)
at Snowflake.Data.Client.SnowflakeDbCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)

  1. What version of .NET driver are you using?
    4.3.0

  2. What operating system and processor architecture are you using?
    Ubuntu

  3. What version of .NET framework are you using?
    .NET Core 8.0.6

It seems like the connector does not retry SocketException, though I did see the code RetryHandler that should take care of it.

Providing the connector logs is VERY complex with SF.
The library requirements are not suitable for real life production where the real bugs happen (instead of incorrect usage).
Tthe library really must adopt the .NET way of logging with ILogger<T> instead of using a very old and deprecated way of forcing users to use log4net.
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-9.0

@gdoron gdoron added the bug label Feb 20, 2025
@github-actions github-actions bot changed the title Socket reset is not handle SNOW-1942008: Socket reset is not handle Feb 20, 2025
@gdoron gdoron changed the title SNOW-1942008: Socket reset is not handle SNOW-1942008: Connection reset is not handled Feb 20, 2025
@sfc-gh-dszmolka sfc-gh-dszmolka self-assigned this Feb 24, 2025
@sfc-gh-dszmolka sfc-gh-dszmolka added status-triage Issue is under initial triage status-information_needed Additional information is required from the reporter labels Feb 24, 2025
@sfc-gh-dszmolka
Copy link
Contributor

hi and thanks for opening this issue with us. To troubleshoot further, we would really prefer to have the logs around what happened.

We do have a documentation how to enable DEBUG level logging for the driver (see: https://github.com/snowflakedb/snowflake-connector-net/blob/master/doc/Logging.md) , amongst them perhaps the most simple is to create a 2-line config file for Easy Logging. Please see in the above docs, how.

Appreciate if you could please send the (sanitized) logs !

If not, can you please describe what your application is doing when it encountered the exception? Are you submitting regular queries , or file transfer (PUT/GET) perhaps ? I assume you submit them asynchronously, but correct me please if i'm wrong.

Finally, about log4net - we also think it should be a thing of the past :) and working on it: #1057

Thank you for any further information. If you're perhaps not comfortable sharing the logs here, you can always create a case with official Snowflake Support and work 1:1 with someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug status-information_needed Additional information is required from the reporter status-triage Issue is under initial triage
Projects
None yet
Development

No branches or pull requests

2 participants