Skip to content

Fix panic in ring source#1568

Merged
AlexxIT merged 8 commits intoAlexxIT:masterfrom
seydx:ring
Feb 17, 2025
Merged

Fix panic in ring source#1568
AlexxIT merged 8 commits intoAlexxIT:masterfrom
seydx:ring

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
57Darling02 pushed a commit to 57Darling02/go2nvr that referenced this pull request Feb 17, 2026
Ring: Fix snapshot producer MarshalJSON and prevent nil reference during stop
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