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 panic in ring source #1568

Merged
merged 8 commits into from
Feb 17, 2025
Merged

Fix panic in ring source #1568

merged 8 commits into from
Feb 17, 2025

Conversation

seydx
Copy link
Contributor

@seydx seydx commented Jan 25, 2025

In my previous PR, I forgot to correctly execute MarshalJSON on a snapshot producer. As a result, for example, the /probe call didn't work on it.

Also, during my testing, I noticed that in rare cases the following error occurs:

DBG [streams] start producer url=ring:?device_id=XXX&refresh_token=XXX&snapshot
DBG [streams] stop producer url=ring:?device_id=XXX&refresh_token=XXX&snapshot

[signal SIGSEGV: segmentation violation code=0x2 addr=0x28 pc=0x102d10330]

goroutine 891 [running]:
github.com/AlexxIT/go2rtc/pkg/ring.(*Client).Start(0x5?)
	github.com/AlexxIT/go2rtc/pkg/ring/client.go:504 +0x20
github.com/AlexxIT/go2rtc/internal/streams.(*Producer).worker(0x140004a2cf0, {0x102fd9128?, 0x1400047a540?}, 0xd)
	github.com/AlexxIT/go2rtc/internal/streams/producer.go:161 +0x34
created by github.com/AlexxIT/go2rtc/internal/streams.(*Producer).start in goroutine 879
	github.com/AlexxIT/go2rtc/internal/streams/producer.go:157 +0x1b0

This PR should fix this by no longer setting the producer to nil during a stop (as is the case with other producers)

@AlexxIT AlexxIT self-assigned this Jan 25, 2025
@AlexxIT AlexxIT merged commit 0e9009b into AlexxIT:master Feb 17, 2025
@AlexxIT
Copy link
Owner

AlexxIT commented Feb 17, 2025

Thanks!

@AlexxIT AlexxIT added this to the v1.9.9 milestone Feb 18, 2025
@AlexxIT AlexxIT changed the title Ring: Fix snapshot producer MarshalJSON and prevent nil reference during stop Fix panic in ring source Mar 10, 2025
@AlexxIT
Copy link
Owner

AlexxIT commented Mar 10, 2025

@seydx seydx deleted the ring branch March 11, 2025 00:44
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.

3 participants