Skip to content

Run the encoders in-process#29

Open
jeromekelleher wants to merge 2 commits into
sgkit-dev:mainfrom
jeromekelleher:drop-process
Open

Run the encoders in-process#29
jeromekelleher wants to merge 2 commits into
sgkit-dev:mainfrom
jeromekelleher:drop-process

Conversation

@jeromekelleher
Copy link
Copy Markdown
Member

Drops the separate multiprocessing.Process encoder-server and the AF_UNIX wire protocol. The VczReader and per-fh BedEncoder / BgenEncoder instances now live in the FUSE handler process. encoder.read, encoder.close, and reader teardown run on worker threads via trio.to_thread.run_sync so the pyfuse3 trio task stays responsive.

The 30s per-read timeout and 2s aclose timeout are preserved — a slow read still surfaces EIO to the kernel rather than blocking the consumer indefinitely. On read timeout the worker thread is abandoned (abandon_on_cancel=True) and the handle is marked dead; aclose drains the abandoned thread via a threading.Event before closing the encoder, or logs a warning and leaks if the encoder is permanently wedged.

The pyfuse3 mount Operations layer is largely untouched — it depends on a Protocol (renamed EncoderClientProto -> EncoderHostProto) that the new EncoderHost / StreamHandle satisfy. The accompanying tests (test_encoder_ops, test_plink_apps, test_bgen_apps) track the rename.

Net diff: -2335 LOC across the deleted encoder_{client,server,protocol} modules and their dedicated test files.

The glibc-arena fragmentation tuning called out in notes/memory_rss_investigation.md (MALLOC_ARENA_MAX, malloc_trim) is deferred to a separate change.

Drops the separate multiprocessing.Process encoder-server and the
AF_UNIX wire protocol. The VczReader and per-fh BedEncoder /
BgenEncoder instances now live in the FUSE handler process.
encoder.read, encoder.close, and reader teardown run on worker threads
via trio.to_thread.run_sync so the pyfuse3 trio task stays responsive.

The 30s per-read timeout and 2s aclose timeout are preserved — a slow
read still surfaces EIO to the kernel rather than blocking the
consumer indefinitely. On read timeout the worker thread is abandoned
(abandon_on_cancel=True) and the handle is marked dead; aclose drains
the abandoned thread via a threading.Event before closing the encoder,
or logs a warning and leaks if the encoder is permanently wedged.

The pyfuse3 mount Operations layer is largely untouched — it depends
on a Protocol (renamed EncoderClientProto -> EncoderHostProto) that
the new EncoderHost / StreamHandle satisfy. The accompanying tests
(test_encoder_ops, test_plink_apps, test_bgen_apps) track the rename.

Net diff: -2335 LOC across the deleted encoder_{client,server,protocol}
modules and their dedicated test files.

The glibc-arena fragmentation tuning called out in
notes/memory_rss_investigation.md (MALLOC_ARENA_MAX, malloc_trim) is
deferred to a separate change.
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