Skip to content

bm_tornado_http crashes on PyPy 3.11: "BufferError: Existing exports of data: object cannot be re-sized" #510

Closed

Description

@sendaoYan

Bug report

Benchmark: tornado_http
Interpreter: PyPy 3.11 (3.11.17) — CPython is unaffected
pyperformance version: 1.14.0
tornado version: 6.5.2
Environment: GitHub Actions ubuntu-latest, matrix entry python: pypy-3.11

Description

Running python -m pyperformance run -b all --debug-single-value (what the
test_run_and_show test does in CI) fails only on PyPy because bm_tornado_http
dies:

1 benchmarks failed:
- tornado_http (Benchmark died)

The benchmark crashes with BufferError: Existing exports of data: object cannot be re-sized, raised from tornado's IOStream._consume where del self._read_buffer[:loc] resizes a buffer that PyPy considers to still have an
active export. tornado then closes the connection, the client sees
HTTPStreamClosedError: Stream closed, and the benchmark process exits non-zero.

Traceback

File ".../tornado/iostream.py", line 993, in _consume
    del self._read_buffer[:loc]
BufferError: Existing exports of data: object cannot be re-sized
Uncaught exception, closing connection.
...
File ".../bm_tornado_http/run_benchmark.py", line 74, in run_client
tornado.simple_httpclient.HTTPStreamClosedError: Stream closed
...
RuntimeError: Benchmark died

Reproducibility

Not a flake — it reproduces on every pypy-3.11 CI run. Both a recent pull-request
run and the main branch run fail identically on tornado_http, so this is
independent of any in-flight change.

Notes

Activity

  1. sendaoYan commented on Nov 9, 2026

    @sendaoYan
    ContributorAuthor

    This should be fixed now.

    The crash comes from IOStream._consume() resizing _read_buffer while a
    temporary memoryview of it is still alive. PyPy 8.0 enforces this rule like
    CPython but does not release the temporary view until garbage collection, so
    del self._read_buffer[:loc] raises BufferError: Existing exports of data: object cannot be re-sized.

    tornado fixed this in 6.6.0 via tornadoweb/tornado#3750 ("iostream: Release
    memoryviews explicitly for PyPy 8.0 compatibility"; see also #3756 and #3757).

    In pyperformance, #502 bumped
    pyperformance/data-files/benchmarks/bm_tornado_http/requirements.txt from
    tornado==6.5.2 to tornado==6.6, so the benchmark now runs on a fixed
    tornado. CI confirms it: the pypy-3.11 job on main installs tornado==6.6,
    runs [84/91] tornado_http... successfully, and is green (e.g. run
    42538627568).

    Closing as fixed by #502 — feel free to reopen if it resurfaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions