zivillian / ism7mqtt

GNU General Public License v3.0
57 stars 11 forks source link

Received an unexpected EOF or 0 bytes from the transport stream. #91

Closed Klaus-Lucas closed 1 month ago

Klaus-Lucas commented 9 months ago

Ich bekomme regelmäßig diese Fehlermeldungen. Kann sich das Programm nicht bei Wolf anmelden? Hatte sowas schon bei dem Wolf-SmartSet-Adapter gesehen (siehe 302). Könntest du das nicht abfangen und nur eine Fehlermeldung ohne Absturz machen oder eine Retry-Counter einbauen?

Dec 27 14:01:33 flosk systemd[1]: Started ism7mqtt.
Dec 27 14:01:35 flosk bash[3663007]: System.IO.IOException:  Received an unexpected EOF or 0 bytes from the transport stream.
Dec 27 14:01:35 flosk bash[3663007]:    at System.Net.Security.SslStream.<FillHandshakeBufferAsync>g__InternalFillHandshakeBufferAsync|189_0[TI>
Dec 27 14:01:35 flosk bash[3663007]:    at System.Net.Security.SslStream.ReceiveBlobAsync[TIOAdapter](TIOAdapter )
Dec 27 14:01:35 flosk bash[3663007]:    at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter , Boolean , Byte[] , B>
Dec 27 14:01:35 flosk bash[3663007]:    at ism7mqtt.Ism7Client.ConnectAsync(CancellationToken cancellationToken) in /home/runner/work/ism7mqtt/>
Dec 27 14:01:35 flosk bash[3663007]:    at ism7mqtt.Ism7Client.RunAsync(String password, CancellationToken cancellationToken) in /home/runner/w>
Dec 27 14:01:35 flosk bash[3663007]:    at ism7mqtt.Program.Main(String[] args) in /home/runner/work/ism7mqtt/ism7mqtt/src/ism7mqtt/Program.cs:>
Dec 27 14:01:35 flosk bash[3663007]: Unhandled exception. System.IO.IOException:  Received an unexpected EOF or 0 bytes from the transport stre>
Dec 27 14:01:35 flosk bash[3663007]:    at System.Net.Security.SslStream.<FillHandshakeBufferAsync>g__InternalFillHandshakeBufferAsync|189_0[TI>
Dec 27 14:01:35 flosk bash[3663007]:    at System.Net.Security.SslStream.ReceiveBlobAsync[TIOAdapter](TIOAdapter )
Dec 27 14:01:35 flosk bash[3663007]:    at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter , Boolean , Byte[] , B>
Dec 27 14:01:35 flosk bash[3663007]:    at ism7mqtt.Ism7Client.ConnectAsync(CancellationToken cancellationToken) in /home/runner/work/ism7mqtt/>
Dec 27 14:01:35 flosk bash[3663007]:    at ism7mqtt.Ism7Client.RunAsync(String password, CancellationToken cancellationToken) in /home/runner/w>
Dec 27 14:01:35 flosk bash[3663007]:    at ism7mqtt.Program.Main(String[] args) in /home/runner/work/ism7mqtt/ism7mqtt/src/ism7mqtt/Program.cs:>
Dec 27 14:01:35 flosk bash[3663007]:    at ism7mqtt.Program.<Main>(String[] args)
Dec 27 14:01:36 flosk bash[3663006]: /opt/ism7mqtt/ism7mqtt_start.sh: line 1: 3663007 Aborted                 (core dumped) OPENSSL_CONF=/opt/i>
Dec 27 14:01:36 flosk systemd[1]: ism7mqtt.service: Main process exited, code=exited, status=134/n/a
Dec 27 14:01:36 flosk systemd[1]: ism7mqtt.service: Failed with result 'exit-code'.
Dec 27 14:01:36 flosk systemd[1]: ism7mqtt.service: Consumed 1.047s CPU time.
Dec 27 14:01:41 flosk systemd[1]: ism7mqtt.service: Scheduled restart job, restart counter is at 1.
Dec 27 14:01:41 flosk systemd[1]: Stopped ism7mqtt.
Dec 27 14:01:41 flosk systemd[1]: ism7mqtt.service: Consumed 1.047s CPU time.
Dec 27 14:01:41 flosk systemd[1]: Started ism7mqtt.
Dec 29 10:34:46 flosk bash[3663027]: System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer.
Dec 29 10:34:46 flosk bash[3663027]:  ---> System.Net.Sockets.SocketException (104): Connection reset by peer
Dec 29 10:34:46 flosk bash[3663027]:    --- End of inner exception stack trace ---
Dec 29 10:34:46 flosk bash[3663027]:    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSou>
Dec 29 10:34:46 flosk bash[3663027]:    at System.Net.Security.SslStream.EnsureFullTlsFrameAsync[TIOAdapter](TIOAdapter )
Dec 29 10:34:46 flosk bash[3663027]:    at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](TIOAdapter , Memory`1 )
Dec 29 10:34:46 flosk bash[3663027]:    at ism7mqtt.Ism7Client.FillPipeAsync(PipeWriter target, CancellationToken cancellationToken) in /home/r>
Dec 29 10:34:46 flosk bash[3663027]: System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer.
Dec 29 10:34:46 flosk bash[3663027]:  ---> System.Net.Sockets.SocketException (104): Connection reset by peer
Dec 29 10:34:46 flosk bash[3663027]:    --- End of inner exception stack trace ---
Dec 29 10:34:46 flosk bash[3663027]:    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSou>
Dec 29 10:34:46 flosk bash[3663027]:    at System.Net.Security.SslStream.EnsureFullTlsFrameAsync[TIOAdapter](TIOAdapter )
Dec 29 10:34:46 flosk bash[3663027]:    at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](TIOAdapter , Memory`1 )
Dec 29 10:34:46 flosk bash[3663027]:    at ism7mqtt.Ism7Client.FillPipeAsync(PipeWriter target, CancellationToken cancellationToken) in /home/r>
Dec 29 10:34:46 flosk bash[3663027]:    at System.IO.Pipelines.Pipe.GetReadResult(ReadResult& )
Dec 29 10:34:46 flosk bash[3663027]:    at System.IO.Pipelines.Pipe.GetReadAsyncResult()
Dec 29 10:34:46 flosk bash[3663027]:    at ism7mqtt.Ism7Client.ReadPipeAsync(PipeReader source, CancellationToken cancellationToken) in /home/r>
Dec 29 10:34:46 flosk systemd[1]: ism7mqtt.service: Deactivated successfully.
Dec 29 10:34:46 flosk systemd[1]: ism7mqtt.service: Consumed 5min 16.700s CPU time.

Ebenso bricht das Programm ab, wenn es die Daten nicht los wird:

Dec 20 13:37:22 flosk systemd[1]: Started ism7mqtt.
Dec 20 13:37:23 flosk bash[590]: MQTTnet.Exceptions.MqttCommunicationException: Error while connecting with host '192.168.178.41:9092'.
Dec 20 13:37:23 flosk bash[590]:  ---> System.Net.Sockets.SocketException (111): Connection refused
Dec 20 13:37:23 flosk bash[590]:    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError , CancellationToken )
Dec 20 13:37:23 flosk bash[590]:    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.>
Dec 20 13:37:23 flosk bash[590]:    at System.Threading.Tasks.ValueTask.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object )
Dec 20 13:37:23 flosk bash[590]: --- End of stack trace from previous location ---
Dec 20 13:37:23 flosk bash[590]:    at MQTTnet.Implementations.CrossPlatformSocket.ConnectAsync(String host, Int32 port, CancellationToken canc>
Dec 20 13:37:23 flosk bash[590]:    --- End of inner exception stack trace ---
Dec 20 13:37:23 flosk bash[590]:    at MQTTnet.Implementations.CrossPlatformSocket.ConnectAsync(String host, Int32 port, CancellationToken canc>
Dec 20 13:37:23 flosk bash[590]:    at MQTTnet.Implementations.MqttTcpChannel.ConnectAsync(CancellationToken cancellationToken)
Dec 20 13:37:23 flosk bash[590]:    at MQTTnet.Internal.MqttTaskTimeout.WaitAsync(Func`2 action, TimeSpan timeout, CancellationToken cancellati>
Dec 20 13:37:23 flosk bash[590]:    at MQTTnet.Adapter.MqttChannelAdapter.ConnectAsync(TimeSpan timeout, CancellationToken cancellationToken)
Dec 20 13:37:23 flosk bash[590]:    at MQTTnet.Client.MqttClient.ConnectAsync(IMqttClientOptions options, CancellationToken cancellationToken)
Dec 20 13:37:23 flosk bash[590]:    at MQTTnet.Client.MqttClient.ConnectAsync(IMqttClientOptions options, CancellationToken cancellationToken)
Dec 20 13:37:23 flosk bash[590]:    at ism7mqtt.Program.Main(String[] args) in /home/runner/work/ism7mqtt/ism7mqtt/src/ism7mqtt/Program.cs:line>
Dec 20 13:37:23 flosk bash[590]: Unhandled exception. MQTTnet.Exceptions.MqttCommunicationException: Error while connecting with host '192.168.>
Dec 20 13:37:23 flosk bash[590]:  ---> System.Net.Sockets.SocketException (111): Connection refused
Dec 20 13:37:23 flosk bash[590]:    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError , CancellationToken )
Dec 20 13:37:23 flosk bash[590]:    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.>
Dec 20 13:37:23 flosk bash[590]:    at System.Threading.Tasks.ValueTask.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object )
Dec 20 13:37:23 flosk bash[590]: --- End of stack trace from previous location ---
Dec 20 13:37:23 flosk bash[590]:    at MQTTnet.Implementations.CrossPlatformSocket.ConnectAsync(String host, Int32 port, CancellationToken canc>
Dec 20 13:37:23 flosk bash[590]:    --- End of inner exception stack trace ---
Dec 20 13:37:23 flosk bash[590]:    at MQTTnet.Implementations.CrossPlatformSocket.ConnectAsync(String host, Int32 port, CancellationToken canc>
Dec 20 13:37:23 flosk bash[590]:    at MQTTnet.Implementations.MqttTcpChannel.ConnectAsync(CancellationToken cancellationToken)
Dec 20 13:37:23 flosk bash[590]:    at MQTTnet.Internal.MqttTaskTimeout.WaitAsync(Func`2 action, TimeSpan timeout, CancellationToken cancellati>
Dec 20 13:37:23 flosk bash[590]:    at MQTTnet.Adapter.MqttChannelAdapter.ConnectAsync(TimeSpan timeout, CancellationToken cancellationToken)
Dec 20 13:37:23 flosk bash[590]:    at MQTTnet.Client.MqttClient.ConnectAsync(IMqttClientOptions options, CancellationToken cancellationToken)
Dec 20 13:37:23 flosk bash[590]:    at MQTTnet.Client.MqttClient.ConnectAsync(IMqttClientOptions options, CancellationToken cancellationToken)
Dec 20 13:37:23 flosk bash[590]:    at ism7mqtt.Program.Main(String[] args) in /home/runner/work/ism7mqtt/ism7mqtt/src/ism7mqtt/Program.cs:line>
Dec 20 13:37:23 flosk bash[590]:    at ism7mqtt.Program.<Main>(String[] args)
Dec 20 13:37:24 flosk bash[572]: /opt/ism7mqtt/ism7mqtt_start.sh: line 1:   590 Aborted                 (core dumped) OPENSSL_CONF=/opt/ism7mqt>
Dec 20 13:37:24 flosk systemd[1]: ism7mqtt.service: Main process exited, code=exited, status=134/n/a
Dec 20 13:37:24 flosk systemd[1]: ism7mqtt.service: Failed with result 'exit-code'.
zivillian commented 1 month ago

Aktuell verlässt sich ism7mqtt darauf, dass es automatisch neu gestartet wird, wenn ein unvorhergesehener Fehler auftritt - dadurch werden auch bei einem Problem weiterhin Daten übertragen und das Problem im Log festgehalten. Dein erster Fehler tritt regelmäßig auf, wenn bereits ein anderes Gerät mit dem ISM Modul verbunden ist (oder das ISM7 glaubt noch eine Verbindung zu haben). Dein zweites Problem tritt nur auf, wenn der MQTT Server nicht erreichbar ist.

Bei beiden Problemen könnte ism7mqtt nicht mehr machen, als ein paar Sekunden warten und es neu versuchen - genau das passiert wenn es sich beendet und dann automatisch neu gestartet wird (wobei beim zweiten Problem potentiell Daten verloren gehen). Wenn ich das in der Software abfangen und ohne Neustart behandeln möchte steigt die Komplexität deutlich an. Ja, ich gebe dir recht, das ist nicht schön, aber in der aktuellen Version der für mich einfachste Weg mit den geringsten Nachteilen für die Nutzer.