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

The WebSocket is in an invalid state ('CloseReceived') #6

Open
janwiesemann opened this issue Dec 16, 2022 · 3 comments
Open

The WebSocket is in an invalid state ('CloseReceived') #6

janwiesemann opened this issue Dec 16, 2022 · 3 comments

Comments

@janwiesemann
Copy link

I just wrote a small app which received live measurements and then pushes them into an influx database. Sadly, I've been experiencing some issues.

I'm running this in a Proxmox LXC-Container using netcoreapp3.1. This issues seams to occur, when the LXC is getting backed up.

The project and source is available at: https://github.com/janwiesemann/tibberToInfluxDB. Not all functions use Tibber.SDK.NET, since it started without this library.

You can find the log below.

Dec 16 11:15:38 MetricCollector tibberToInfluxDB[1815205]: home 0000000-11111-2222-3333-44444444444 subscription 1: no data received during last 62,524 ms; re-initialize data stream
Dec 16 11:15:38 MetricCollector tibberToInfluxDB[1815205]: subscribe to 0000000-11111-2222-3333-44444444444
Dec 16 11:15:38 MetricCollector tibberToInfluxDB[1815205]: web socket operation failed System.Net.WebSockets.WebSocketException (0x80004005): The WebSocket is in an invalid state ('CloseReceived') for this operation. Valid states are: 'Open, CloseSent'
                                                              at System.Net.WebSockets.WebSocketValidate.ThrowIfInvalidState(WebSocketState currentState, Boolean isDisposed, WebSocketState[] validStates)
                                                              at System.Net.WebSockets.ManagedWebSocket.ReceiveAsync(ArraySegment`1 buffer, CancellationToken cancellationToken)
                                                           --- End of stack trace from previous location where exception was thrown ---
                                                              at Tibber.Sdk.RealTimeMeasurementListener.StartListening()
Dec 16 11:15:38 MetricCollector tibberToInfluxDB[1815205]: System.Net.WebSockets.WebSocketException (0x80004005): The WebSocket is in an invalid state ('CloseReceived') for this operation. Valid states are: 'Open, CloseSent'
Dec 16 11:15:38 MetricCollector tibberToInfluxDB[1815205]:    at System.Net.WebSockets.WebSocketValidate.ThrowIfInvalidState(WebSocketState currentState, Boolean isDisposed, WebSocketState[] validStates)
Dec 16 11:15:38 MetricCollector tibberToInfluxDB[1815205]:    at System.Net.WebSockets.ManagedWebSocket.ReceiveAsync(ArraySegment`1 buffer, CancellationToken cancellationToken)
Dec 16 11:15:38 MetricCollector tibberToInfluxDB[1815205]: --- End of stack trace from previous location where exception was thrown ---
Dec 16 11:15:38 MetricCollector tibberToInfluxDB[1815205]:    at Tibber.Sdk.RealTimeMeasurementListener.StartListening()
Dec 16 11:15:38 MetricCollector tibberToInfluxDB[1815205]: listener disposal started
Dec 16 11:15:38 MetricCollector tibberToInfluxDB[1815205]: listener disposal finished

Note: GUIDs changed!

@toini
Copy link
Contributor

toini commented Feb 22, 2023

@janwiesemann did you figure this one out?

@janwiesemann
Copy link
Author

@toini not really, I haven't had the time to do so. I've worked around this issue by hard crashing my application and using a systemd service to automatically restart it a few minutes later.

@toini
Copy link
Contributor

toini commented Mar 2, 2023

@janwiesemann I have a vague memory i saw something similar before and incorrectly interpreted some of the log rows indicating failure while it had actually been intended behaviour. However im not sure if this is a similar case.

Would you have any instructions on how i could reproduce this myself? What lead this situation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants