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

Fix writer nullpointer panic on network reconnect #681

Merged
merged 2 commits into from
Jan 18, 2025

Conversation

SijmenHuizenga
Copy link
Contributor

@SijmenHuizenga SijmenHuizenga commented Jan 17, 2025

In #655 the change was made in client.go to set writer to nil, before completing the 'closing' of the client. This makes that if someone calls WritePacketRTPWithNTP after writer = nil but before c.done is closed, there is a panic. As described in #678.

I don't fully understand why c.writer = nil is needed in the first place. It seems that before #655 c.writer is never set to nil. And after testing the situation of the panic, this resolved it. If someone has a better solution I'm very eager to learn!

@aler9 aler9 force-pushed the fix-writer-nullptr-panic branch from f3cf4a9 to 05ecfe8 Compare January 18, 2025 18:13
@aler9
Copy link
Member

aler9 commented Jan 18, 2025

writer was set to nil to prevent chWriterError from returning a closed channel and therefore messing up the client loop. Anyway, this was causing issues both when the client was closing and when the client was paused, so the fix is right. Thanks.

@aler9 aler9 force-pushed the fix-writer-nullptr-panic branch from 05ecfe8 to c18f8db Compare January 18, 2025 18:25
@aler9 aler9 merged commit b2cfa93 into bluenviron:main Jan 18, 2025
7 checks passed
@SijmenHuizenga
Copy link
Contributor Author

AMAZING! Thank you so much for the proper fix!

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