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

Avoid logging graceful disconnect as error #987

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

elupus
Copy link
Collaborator

@elupus elupus commented Nov 13, 2024

The chromecasts restart each night, and seem to
generally do this by doing a socket shutdown of
write leading to a EOF received by clients.

No need to log this as an error

The chromecasts restart each night, and seem to
generally do this by doing a socket shutdown of
write leading to a EOF received by clients.

No need to log this as an error
@elupus
Copy link
Collaborator Author

elupus commented Nov 13, 2024

Next step would be to add some backoff on reconnect. Not verified this, but if they behave correctly (which I suspect they do) they remove their mdns entry either before or more likely after they disconnect.

So we should hit the mdns backoff if we delay just a little. But not fully sure how to add that delay.

@elupus
Copy link
Collaborator Author

elupus commented Nov 13, 2024

Hmm. I wonder should we set stop()? Will something restart the thread again when a service is spotted?

@emontnemery
Copy link
Collaborator

Not verified this, but if they behave correctly (which I suspect they do) they remove their mdns entry either before or more likely after they disconnect.

I've had lots of problems with this before. We need a solution which works well both when the restart is unexpected, for example a power cut, and when the device reboots normally.

@emontnemery
Copy link
Collaborator

Hmm. I wonder should we set stop()? Will something restart the thread again when a service is spotted?

Please elaborate. Which thread are you talking about?

@emontnemery
Copy link
Collaborator

I think debug level is way too quiet in case of an unexpected disconnect, info would be better.

@elupus
Copy link
Collaborator Author

elupus commented Dec 3, 2024

This is not unexpected. Its a gracefull requested shutdown from remote, which occurs nightly. We can have it at INFO, since that is hidden in HA by default.

@elupus
Copy link
Collaborator Author

elupus commented Dec 3, 2024

The point is, when we get a graceful disconnect (eof from remote), we should delay the reconnect untill either some set timeout or a mdns broadcast is seen.

In case of a non graceful disconnect (socket RST), we can try to reconnect directly.

@elupus
Copy link
Collaborator Author

elupus commented Dec 3, 2024

Hmm. I wonder should we set stop()? Will something restart the thread again when a service is spotted?

Please elaborate. Which thread are you talking about?

If i understand correctly each client handling a socket is a separate thread. To wait for next mdns event i was thinking of stopping down the current client thread and restarting on next announce. But I'm not fully following the code yet. So baby steps.

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

Successfully merging this pull request may close these issues.

2 participants