Comments (1)
We are also experiencing this issue when using the library with version 3.1.1 and .Net framework. If the connection for some reason is closed down, the library will not manage to reconnect.
Initially, one of these errors appear in the self-log:
System.IO.IOException: Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
or
System.InvalidOperationException: BeginConnect cannot be called while another asynchronous operation is in progress on the same Socket.
It then starts logging these exceptions:
System.Net.Sockets.SocketException: A connect request was made on an already connected socket
And no logs are sent to Graylog.
It would be great if the library was able to reconnect and also would retry sending the log that was being sent when the exception was thrown.
Looked briefly in the code, and seems that there was a recent change that tries to reuse the TcpClient (9e99541#diff-8e1abe872c46b6cae1e6bbbe1d75740d57568e0af85b353602c7157f5522a5e0), but as I understand it a TcpClient is not designed to be reused. So that might be a possible cause of the issue.
Full stack traces below:
Oops something going wrong System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: BeginConnect cannot be called while another asynchronous operation is in progress on the same Socket.
at System.Net.Sockets.Socket.BeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state)
at System.Net.Sockets.Socket.BeginConnect(IPAddress address, Int32 port, AsyncCallback requestCallback, Object state)
at System.Net.Sockets.TcpClient.BeginConnect(IPAddress address, Int32 port, AsyncCallback requestCallback, Object state)
at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2](Func`5 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
at System.Net.Sockets.TcpClient.ConnectAsync(IPAddress address, Int32 port)
at Serilog.Sinks.Graylog.Core.Transport.Tcp.TcpTransportClient.<Connect>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Serilog.Sinks.Graylog.Core.Transport.Tcp.TcpTransportClient.<EnsureConnection>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Serilog.Sinks.Graylog.Core.Transport.Tcp.TcpTransportClient.<Send>d__6.MoveNext()
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.InvalidOperationException: BeginConnect cannot be called while another asynchronous operation is in progress on the same Socket.
at System.Net.Sockets.Socket.BeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state)
at System.Net.Sockets.Socket.BeginConnect(IPAddress address, Int32 port, AsyncCallback requestCallback, Object state)
at System.Net.Sockets.TcpClient.BeginConnect(IPAddress address, Int32 port, AsyncCallback requestCallback, Object state)
at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2](Func`5 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
at System.Net.Sockets.TcpClient.ConnectAsync(IPAddress address, Int32 port)
at Serilog.Sinks.Graylog.Core.Transport.Tcp.TcpTransportClient.<Connect>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Serilog.Sinks.Graylog.Core.Transport.Tcp.TcpTransportClient.<EnsureConnection>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Serilog.Sinks.Graylog.Core.Transport.Tcp.TcpTransportClient.<Send>d__6.MoveNext()<---
Oops something going wrong System.AggregateException: One or more errors occurred. ---> System.IO.IOException: Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
at System.Net.Sockets.Socket.BeginSend(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)
at System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.IO.Stream.<>c.<BeginEndWriteAsync>b__53_0(Stream stream, ReadWriteParameters args, AsyncCallback callback, Object state)
at System.Threading.Tasks.TaskFactory`1.FromAsyncTrim[TInstance,TArgs](TInstance thisRef, TArgs args, Func`5 beginMethod, Func`3 endMethod)
at System.IO.Stream.BeginEndWriteAsync(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.Stream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
at System.IO.Stream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count)
at Serilog.Sinks.Graylog.Core.Transport.Tcp.TcpTransportClient.<Send>d__6.MoveNext()
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.IO.IOException: Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
at System.Net.Sockets.Socket.BeginSend(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)
at System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.IO.Stream.<>c.<BeginEndWriteAsync>b__53_0(Stream stream, ReadWriteParameters args, AsyncCallback callback, Object state)
at System.Threading.Tasks.TaskFactory`1.FromAsyncTrim[TInstance,TArgs](TInstance thisRef, TArgs args, Func`5 beginMethod, Func`3 endMethod)
at System.IO.Stream.BeginEndWriteAsync(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.Stream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
at System.IO.Stream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count)
at Serilog.Sinks.Graylog.Core.Transport.Tcp.TcpTransportClient.<Send>d__6.MoveNext()
Oops something going wrong System.AggregateException: One or more errors occurred. ---> System.Net.Sockets.SocketException: A connect request was made on an already connected socket
at System.Net.Sockets.Socket.BeginConnectEx(EndPoint remoteEP, Boolean flowContext, AsyncCallback callback, Object state)
at System.Net.Sockets.Socket.BeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state)
at System.Net.Sockets.Socket.BeginConnect(IPAddress address, Int32 port, AsyncCallback requestCallback, Object state)
at System.Net.Sockets.TcpClient.BeginConnect(IPAddress address, Int32 port, AsyncCallback requestCallback, Object state)
at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2](Func`5 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
at System.Net.Sockets.TcpClient.ConnectAsync(IPAddress address, Int32 port)
at Serilog.Sinks.Graylog.Core.Transport.Tcp.TcpTransportClient.<Connect>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Serilog.Sinks.Graylog.Core.Transport.Tcp.TcpTransportClient.<EnsureConnection>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Serilog.Sinks.Graylog.Core.Transport.Tcp.TcpTransportClient.<Send>d__6.MoveNext()
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.Net.Sockets.SocketException (0x80004005): A connect request was made on an already connected socket
at System.Net.Sockets.Socket.BeginConnectEx(EndPoint remoteEP, Boolean flowContext, AsyncCallback callback, Object state)
at System.Net.Sockets.Socket.BeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state)
at System.Net.Sockets.Socket.BeginConnect(IPAddress address, Int32 port, AsyncCallback requestCallback, Object state)
at System.Net.Sockets.TcpClient.BeginConnect(IPAddress address, Int32 port, AsyncCallback requestCallback, Object state)
at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2](Func`5 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
at System.Net.Sockets.TcpClient.ConnectAsync(IPAddress address, Int32 port)
at Serilog.Sinks.Graylog.Core.Transport.Tcp.TcpTransportClient.<Connect>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Serilog.Sinks.Graylog.Core.Transport.Tcp.TcpTransportClient.<EnsureConnection>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Serilog.Sinks.Graylog.Core.Transport.Tcp.TcpTransportClient.<Send>d__6.MoveNext()<---
from serilog-sinks-graylog.
Related Issues (20)
- Nuget package requires System.Text.Json version 7.0.2 HOT 1
- Deadlock Task HOT 1
- Make DefaultSerializerSettings non-readonly HOT 4
- Logging seems to be broken for synchronous WebForms on .NET 4.x HOT 1
- TCP transport not ThreadSafe
- GELF TCP TLS authentication HOT 2
- How to pass Authorization headers for graylog? HOT 2
- Issue with adding properties to logging with LogContext.Pushproperty and .Net6 HOT 1
- TcpTransport can we override ? HOT 1
- Is Graylog 4 supported? HOT 2
- Unhandled exception if graylog goes down HOT 2
- Feature request: Disable compression HOT 1
- .NET 6 + GELF TCP hangs after some time
- Set useSsl from appsettings.json HOT 2
- Serilog stops logging after the 4 line in Graylog HOT 4
- Issue with update to version 3.0.0 HOT 4
- Version 3.0.1 not working HOT 7
- Exception messages are not sent to Graylog with version 3.0.1 HOT 3
- Unable to cast object of type 'Serilog.Sinks.Graylog.Batching.PeriodicBatchingGraylogSink' to type 'Serilog.Core.ILogEventSink' HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serilog-sinks-graylog.