This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2022-02-03.08:34:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1643877280.17.0.469977325894.issue46623@roundup.psfhosted.org>
In-reply-to
Content
test_pair() and test_speech128() tests of test_zlib fail on the s390x architecture if zlib uses the s390x hardware accelerator.

RHEL8 downstream issues (with most details):
https://bugzilla.redhat.com/show_bug.cgi?id=1974658

Fedora downstream issues:
https://bugzilla.redhat.com/show_bug.cgi?id=2038848

The s390x has a hardware accelerator for zlib. Depending if the hardware accelerator is used or not, the output (compress data) is different.

Also, test_zlib compress data in two different ways and then expect the same output. test_zlib pass with the software implementation which creates a single (final) compressed block. test_zlib fails with the hardware implementation which creates multiple compressed blocks (the last one is a final block).

Another reason the output differs is the FHT/DHT heuristic. The zlib deflate algorithm can analyze the data distribution and decide whether it wants to use a fixed-Huffman table (FHT) or a dynamic-Huffman table (DHT) for the next block, but the accelerator can't. Furthermore, looking at data in software would kill the accelerator performance. Therefore the following heuristic is used on s390x: the first 4k are compressed with FHT and the rest of the data with DHT. So, compress() creates a single FHT block. compressobj() creates a FHT block, a DHT block and a trailing block.

It is *not a bug* in zlib: the decompression gives back the original content as expected in all cases. The issue is that Python test_zlib makes too many assumptions on how "streamed" data should be compressed. The test expected that compressed data using different ways to call zlib would return the exact same compressed data. If an accelarator is used, it's not always the case.
History
Date User Action Args
2022-02-03 08:34:40vstinnersetrecipients: + vstinner
2022-02-03 08:34:40vstinnersetmessageid: <1643877280.17.0.469977325894.issue46623@roundup.psfhosted.org>
2022-02-03 08:34:40vstinnerlinkissue46623 messages
2022-02-03 08:34:39vstinnercreate