cs2: include channel number and queue depth in pop buffer error - #2385
Open
zealllot wants to merge 1 commit into
Open
cs2: include channel number and queue depth in pop buffer error#2385zealllot wants to merge 1 commit into
zealllot wants to merge 1 commit into
Conversation
The error says which resource overflowed but not which channel, and the surrounding "read media" context comes from whichever producer noticed the dead connection - not from the channel that actually filled up. Since worker() tears the whole connection down when any channel's Push fails, a full command queue is reported as a media read error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a cs2 data channel's pop buffer overflows, the error doesn't say which channel filled up:
The
read mediaprefix comes from whichever producer noticed the connection had died — it does not mean the media channel is the one that overflowed.worker()tears down the entire connection when any channel'sPushfails (pkg/xiaomi/miss/cs2/conn.go:159-162), so a full command queue also surfaces as a "read media" error.Change
One line, so the source is unambiguous:
Why this matters
There are currently three open PRs targeting this same log line, and they disagree about the root cause:
buffer=URL param that only resizes ch2.Both diagnoses are plausible from the current message, and a reporter cannot tell which one applies to their logs. With the channel number present, triage becomes a single grep.
Evidence
On my setup (
xiaomi.camera.083ac1,cs2+tcp, one consumer through the rtsp loopback) a binary built from this branch shows it is unambiguously the command channel:It recurs every ~130–170 s, which lines up with ch0's cap of 10 against a camera sending roughly one control message every 13–17 s. Consistent with that,
ReadCommand()is called exactly once in the tree —pkg/xiaomi/miss/client.go:113, during login — so nothing consumes ch0 afterwards; everything past login is write-only (StartMedia/StopMedia/StartAudio/StartSpeaker). That matches #2280's analysis for this camera model.Scope
This PR deliberately does not fix the overflow — it only makes the existing error actionable, so it stays orthogonal to whichever of the three fixes you prefer.