Skip to content

Stop leaking video consumption threads in Jetson producer-selection tests - #3116

Merged
PawelPeczek-Roboflow merged 4 commits into
mainfrom
fix/video-source-tests-leaked-threads
Oct 8, 2026
Merged

PawelPeczek-Roboflow merged 4 commits into
mainfrom
fix/video-source-tests-leaked-threads

Conversation

@PawelPeczek-Roboflow

@PawelPeczek-Roboflow PawelPeczek-Roboflow commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

What

Three tests in tests/inference/unit_tests/core/interfaces/camera/test_video_source.py start a VideoSource on a mocked producer and never stop it:

  • test_video_source_selects_gstreamer_producer_for_rtsps_on_jetson
  • test_video_source_selects_gstreamer_for_rtsps_when_running_on_jetson_alias_resolves
  • test_video_source_keeps_cv2_producer_for_plain_rtsp_on_jetson

Why

The consumption thread outlives the test. It calls video.retrieve() on a MagicMock, and unpacking a MagicMock yields 0 items. The thread catches the exception and logs:

ERROR Encountered error in video consumption thread
ValueError: not enough values to unpack (expected 2, got 0)

CI stays green, but the traceback shows up in unit-test logs (seen in #3114, job log). This is a test-only problem: real producers always return a 2-tuple.

Fix

  • Mock retrieve() to return (False, None), so the thread exits cleanly.
  • Call the existing tear_down_source(source) helper at the end of each test.

Verification (local, Python 3.12)

  • test_video_source.py: 66 passed.
  • pytest -s -k jetson: the traceback appears 3 times before the fix and 0 times after it.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Updated camera-source tests to verify teardown after frame retrieval fails across Jetson GStreamer and RTSP configurations.

…ests

Three tests in test_video_source.py start a VideoSource on a MagicMock
producer and never terminate it. The background thread keeps reading,
unpacks MagicMock().retrieve() (0 items) and logs
"ValueError: not enough values to unpack (expected 2, got 0)". The
exception is caught in the thread, so CI stays green but the log shows
a scary traceback.

Mock retrieve() to return (False, None) so the thread exits cleanly,
and terminate the source at the end of each test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

👋 Thanks for the pull request! Here is how automated Claude review works here, so you spend credits (and reviewer time) wisely.

🚦 This PR is marked Ready for review, so automated Claude review will run — and every pass spends real credits.

Warning

💸 The Claude reviewer bills in credits, not vibes

Automated review spins up a real agent that reads real code and spends real credits on every pass. It is glad to help — but it is not a rubber duck, a linter you poke in a loop, or a substitute for reading the contributing guide. Treat it like an expensive senior reviewer whose time you booked, and show up prepared.

Draft when unsure, Ready when you mean it:

  • 🌱 Not sure the PR is in good shape yet? Keep it (or set it back) as a draft — drafts pause review, so you can push and iterate without burning credits on a moving target.
  • 💪 Feel strong about the contents? Mark it Ready for review and the reviewer will take a look.

However you get there, arrive prepared:

  • 🧱 Bring a SOLID, thorough PR. Point your local agent at our skills/ to tune it to our guidelines first — or, if you are one of those fabled carbon-based contributors, read them yourself. A half-baked diff costs exactly the same to review as a finished one.
  • ✅ Resolve every comment before you re-request review. Re-requesting with threads still open means paying twice for the same conversation.
  • 🔁 Do not use CI review as an inner loop for a local agent. The reviewer is not a step-by-step debugger — do the unfolding locally and arrive with the answer, not the search.
  • 🙋 If something looks off, ask a human. One question to a maintainer is cheaper and faster than three rounds of agent re-review chasing a misread.

Reviews are not free. A draft costs nothing to review; a Ready PR is a promise that it is worth reviewing.

  • Prefer to skip automated review entirely? Add the skip-claude-review label.

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

🤖 Claude review started at commit 895f0b18151abdb02354a0de2c8f2fb3b072d2a7.

New commits are not auto-reviewed. Add the claude-review label to request a re-review — the label is consumed when the review starts, so just add it again next time.

@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 18f57c53-a1dc-4cf3-9429-a87a632352e2
📥 Commits

Reviewing files that changed from the base of the PR and between 9eb32c6 and 00d298d.

📒 Files selected for processing (1)
  • tests/inference/unit_tests/core/interfaces/camera/test_video_source.py
 _________________________________________
< Make it work, make it right, make it 🥕. >
 -----------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@PawelPeczek-Roboflow
PawelPeczek-Roboflow merged commit 1172255 into main Oct 8, 2026
82 checks passed
@PawelPeczek-Roboflow
PawelPeczek-Roboflow deleted the fix/video-source-tests-leaked-threads branch October 8, 2026 09:55
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