Skip to content

Configuring compressOptions can lead to silently failing requests #3741

@f-loris

Description

@f-loris

I'm using reactor-netty via Spring boot and I configured compressOptions where I only modified the ZstdOption

httpServer.compressOptions(
  ZstdOption.builder()... .build()
 )

When configuring compressOptions, the default windowBits values for GZIP and Deflate compression are unexpectedly overridden by Reactor Netty's defaults, rather than retaining Netty's original defaults. This behavior is not clearly documented and may lead to unexpected failures.

We're observing that any request relying on GZIP or Deflate compression silently fails and remains pending indefinitely when windowBits is changed from the default 15 to 12 — as happens when compressOptions are customized.

Expected Behavior

Only the configuration of the configured compression algorithm shall change and no other algorithms shall be impacted (GZIP, Defalte).

Actual Behavior

The defaults applied for GZIP and Defalte differ.
For instance, for GZIP the window bits are set to 12 bits

Netty's default are 15:
https://github.com/netty/netty/blob/7ac5e2ba20030caad0d0e648e86f31e9f0461105/codec-compression/src/main/java/io/netty/handler/codec/compression/GzipOptions.java#L29

When no compressOptions are specified, it will apply the defaults from Netty. Otherwise the ones from reactor-netty are applied - which unfortunately differ in windowBits.
https://github.com/netty/netty/blob/netty-4.1.118.Final/codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java#L182

Possible Solution

Align the defaults with the standards of Netty.

Workaround

Aligning windows bits to 15 explicitly:

 httpServer.compressOptions(
    GzipOption.builder().windowBits(15).build(), 
    DeflateOption.builder().windowBits(15).build(),
    ZstdOption.builder().....build()
 )

Your Environment

  • Reactor version(s) used: 1.2.3
  • Netty: 4.1.118
  • JVM version: 21

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions