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

Ring: Fix snapshot producer MarshalJSON and prevent nil reference during stop #1568

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
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