Skip to content

blockbuster: allow os.sendfile from asyncio selector loop - #6864

Merged
agners merged 1 commit into
mainfrom
work-around-os-sendfile-blockbuster-bug
May 22, 2026
Merged

blockbuster: allow os.sendfile from asyncio selector loop#6864
agners merged 1 commit into
mainfrom
work-around-os-sendfile-blockbuster-bug

Conversation

@agners

@agners agners commented May 20, 2026

Copy link
Copy Markdown
Member

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

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality to the supervisor)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to cli pull request:
  • Link to client library pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Ruff (ruff format supervisor tests)
  • Tests have been added to verify that the new code works.

If API endpoints or add-on configuration are added/changed:

@agners agners added the refactor A code change that neither fixes a bug nor adds a feature label May 20, 2026
@agners
agners requested a review from mdegat01 May 20, 2026 21:14
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
agners force-pushed the work-around-os-sendfile-blockbuster-bug branch from d15f671 to 7716fcf Compare May 20, 2026 21:15
@agners
agners merged commit 2a21646 into main May 22, 2026
21 checks passed
@agners
agners deleted the work-around-os-sendfile-blockbuster-bug branch May 22, 2026 09:55
@github-actions github-actions Bot locked and limited conversation to collaborators May 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed refactor A code change that neither fixes a bug nor adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants