blockbuster: allow os.sendfile from asyncio selector loop - #6864
Merged
Conversation
Serving aiohttp FileResponse triggers BlockBuster's os.sendfile guard because the actual syscall happens in asyncio/unix_events.py's _sock_sendfile_native_impl rather than the base_events.sendfile entry point that blockbuster whitelists. The socket is non-blocking and EAGAIN is handled by re-registering a writer, so the call is safe. Extend the os.sendfile allowlist with the selector-loop caller as a local workaround. Fixed upstream by cbornet/blockbuster#58 (issue cbornet/blockbuster#57); drop this once blockbuster is bumped to a version that includes the fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
agners
force-pushed
the
work-around-os-sendfile-blockbuster-bug
branch
from
May 20, 2026 21:15
d15f671 to
7716fcf
Compare
mdegat01
approved these changes
May 22, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Proposed change
Serving aiohttp FileResponse triggers BlockBuster's os.sendfile guard because the actual syscall happens in asyncio/unix_events.py's _sock_sendfile_native_impl rather than the base_events.sendfile entry point that blockbuster whitelists. The socket is non-blocking and EAGAIN is handled by re-registering a writer, so the call is safe.
Extend the os.sendfile allowlist with the selector-loop caller as a local workaround. Fixed upstream by
cbornet/blockbuster#58 (issue cbornet/blockbuster#57); we can remove this work around once blockbuster is bumped to a version that includes the fix.
Type of change
Additional information
Checklist
ruff format supervisor tests)If API endpoints or add-on configuration are added/changed: