Skip to content

gh-159425: Fix concurrent zlib compressor test with intermediate output - #159429

Open
zolaski333 wants to merge 1 commit into
python:mainfrom
zolaski333:codex/gh-159425-zlib-concurrent-output
Open

zolaski333 wants to merge 1 commit into
python:mainfrom
zolaski333:codex/gh-159425-zlib-concurrent-output

Conversation

@zolaski333

@zolaski333 zolaski333 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #159425.

The concurrent compressor test assumes that subsequent compress() calls
return empty bytes. This fails with the s390x hardware accelerator and can also
fail with ordinary zlib when it emits intermediate output.

Collect the actual output of two concurrent calls on the same compressor and
try both possible output orders, since threads can append their results in a
different order from the compressor's internal serialization. Require an exact
round trip, end of stream, and no trailing data. This keeps the calls concurrent
without requiring reproducible compressed bytes or adding an external lock.

Exercise both the existing default-compression input and large uncompressed
blocks that emit intermediate output. Add a Tests NEWS entry.

Validation on Windows x64 with zlib-ng 2.2.4:

  • Release free-threading build, GIL disabled and enabled:
    -X dev -m test test_free_threading.test_zlib test_zlib test_gzip
    (171 tests run, 2 skipped in each mode).
  • Debug free-threading build:
    -X dev -m test -R 3:3 test_free_threading.test_zlib test_zlib
    (92 tests run, 1 skipped; no reference leaks detected).
  • 1,000 repetitions of both compressor subtests with the GIL disabled.
  • Local fault injection rejects corrupt or missing output, missing or duplicated
    input, truncated streams, and trailing data. Reversed result collection and
    eager intermediate output pass.
  • Tools/patchcheck/patchcheck.py and git diff --check pass.

s390x hardware validation has not been performed; confirmation on an affected
builder is still needed.

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

Labels

awaiting review tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_free_threading.test_zlib fails on s390x with hardware zlib accelerator

1 participant