Skip to content

fix(capture): recorder kill on shutdown timeout, Python 3.9 loop binding, events() before start - #131

Merged
lalit-videodb merged 1 commit into
release-0-5-5from
lalit/capture-shutdown-hardening
Nov 30, 2026
Merged

lalit-videodb merged 1 commit into
release-0-5-5from
lalit/capture-shutdown-hardening

Conversation

@lalit-videodb

Copy link
Copy Markdown
Collaborator

Three should-fix items from the 0.5.5 release review. All are in videodb/capture.py.

A recorder that never acknowledges shutdown was left running

  • shutdown() raised on a missing acknowledgement or exit and left the process alive. 0.5.4 always terminated it.
  • It now kills the process and re-raises, as videodb-node does. The normal path is unchanged: finalization is not interrupted.

A client built outside the event loop failed on Python 3.8 and 3.9

  • Queue, Event and Lock were created in __init__. Those Python versions bind them to the loop at construction, so client = CaptureClient(...) followed by asyncio.run(main(client)) failed with "attached to a different loop".
  • They are now created on first use, inside the running loop.

events() ended after one second when called before start

  • The capture guide says to consume events() before starting capture, to catch recording-live. The generator stopped as soon as it saw no recorder.
  • It now waits until a recorder has run and exited. After shutdown it ends as before.

Checks: 28 tests pass on Python 3.9.6 and 3.12, with two new cases added to tests/test_capture.py. Both new cases fail on the current release-0-5-5. ruff check is clean. Not run against the real binary.

Not changed here: shutdown() still waits for processing by default (up to 900 s). That default is a product call.

…ient on Python 3.9; events() waits for start
@lalit-videodb
lalit-videodb merged commit c37b585 into release-0-5-5 Nov 30, 2026
1 check failed
@lalit-videodb lalit-videodb mentioned this pull request Nov 30, 2026
@lalit-videodb
lalit-videodb deleted the lalit/capture-shutdown-hardening branch November 30, 2026 11:24
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.

1 participant