Skip to content

add tests & fix weird behaviour#31

Closed
MayNiklas wants to merge 6 commits into
better-import-handlingfrom
add-tests-better-import-handling
Closed

add tests & fix weird behaviour#31
MayNiklas wants to merge 6 commits into
better-import-handlingfrom
add-tests-better-import-handling

Conversation

@MayNiklas
Copy link
Copy Markdown
Owner

This PR should be merged into #28 .

Adds unit tests for the transcription itself.

We hade some weird issues with our pipes after #25:

  • after 18 transcriptions, the result was not being given back to the main thread -> result was never shown
  • this was reproducible on all Linux systems (NixOS, Ubuntu, Debian, Docker, without Docker)
  • the issue was not existent on MacOS - only on Linux.

To investigate the issue, I created a unit test for the scenario.
After a lot of headaches, AI was able to create a fix.
-> we now handle pipes safer

…lity test

- Use find_free_port() and Path(__file__) for reliable test execution
- Add setUpClass server readiness check and graceful tearDownClass cleanup
- Add tests for version, invalid task_id, non-audio upload, translate
- Add stability test that runs all iterations and reports aggregate failures
- Skip all tests by default (require whisper model to run)
…sends

- log_setup: use select() in PipedFileHandler.emit() to avoid blocking
  when the logging pipe buffer is full in child processes, preventing the
  listener thread from freezing and cascading into a full pipe deadlock
- decoder: add pipe_send_lock to serialize concurrent pipe_to_parent.send()
  calls between the run() and decode_loop() threads
- main: use os._exit(0) instead of sys.exit(0) to avoid SystemExit
  propagating through the asyncio event loop during signal-driven shutdown
Buffer log records into a queue.Queue in child processes and drain them
to the pipe in a dedicated daemon thread, so emit() never blocks the
caller and no log records are lost when the pipe buffer is full.
@MayNiklas MayNiklas requested a review from nonchris May 20, 2026 11:56
@nonchris
Copy link
Copy Markdown
Collaborator

i see what was changed, but why does having an extra thread that moves messages from queue to pipe resolve a deadlock?

@nonchris nonchris mentioned this pull request May 20, 2026
@MayNiklas MayNiklas closed this May 21, 2026
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