Skip to content

Update zstd-jni to 1.5.7-25 and call setLongMax directly - #3721

Merged
pjfanning merged 1 commit into
apache:mainfrom
pjfanning:zstd-jni-1.5.7-25
Oct 28, 2026
Merged

pjfanning merged 1 commit into
apache:mainfrom
pjfanning:zstd-jni-1.5.7-25

Conversation

@pjfanning

@pjfanning pjfanning commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Motivation

#3710 looked up ZstdDecompressCtx.setLongMax with a MethodHandle, because no zstd-jni release had it yet (luben/zstd-jni#431), and left a TODO to call it directly once one did. zstd-jni 1.5.7-25 includes setLongMax.

Modification

  • Update zstd-jni from 1.5.7-24 to 1.5.7-25.
  • Call ZstdDecompressCtx.setLongMax directly in ZstdDecompressor and remove the MethodHandle lookup and the TODO.
  • zstd-jni is still an optional dependency that users add themselves, so an older version can be on the classpath. The direct call then throws NoSuchMethodError, which is caught and rethrown as the same UnsupportedOperationException as before. A LinkageError is not NonFatal, so without this the decompression context would not be closed when materialization fails. The default path (no window limit) never calls setLongMax and still works with older zstd-jni versions.
  • ZstdSpec: drop the branch for a zstd-jni without setLongMax, so the window limit test always checks that a 2^24-window frame is rejected at 23 and decodes at 24.
  • Update the withWindowLogMax scaladoc and the zstdDecompress page to name 1.5.7-25 as the minimum zstd-jni version.

Result

The zstd decompression window limit works with the zstd-jni version Pekko depends on, without reflection.

The zstd-jni 1.5.7-24 line in the 2.0.0 release notes is not changed here, to avoid a conflict with #3675. I will update it there once this is merged.

Tests

  • sbt "stream-tests/testOnly org.apache.pekko.stream.io.compression.ZstdSpec org.apache.pekko.stream.io.compression.CompressionWithoutZstdSpec": 42 passed, 1 pending (existing)
  • sbt "++3.3.8 stream/compile"
  • scalafmt on the changed Scala files
  • MiMa not run: only @InternalApi code and docs changed

References

Refs #3674, #3710

Motivation:
apache#3710 looked up ZstdDecompressCtx.setLongMax with a MethodHandle because no zstd-jni
release had it. zstd-jni 1.5.7-25 includes it, so the lookup can go.

Modification:
- Update zstd-jni from 1.5.7-24 to 1.5.7-25.
- Call ZstdDecompressCtx.setLongMax directly instead of through a MethodHandle. zstd-jni
  is an optional dependency, so a NoSuchMethodError from an older version is still turned
  into an UnsupportedOperationException.
- Drop the test branch for a zstd-jni without setLongMax, and update the docs to name
  1.5.7-25 as the minimum version for withWindowLogMax.

Result:
The zstd decompression window limit works with the zstd-jni version Pekko depends on.

Tests:
- sbt "stream-tests/testOnly org.apache.pekko.stream.io.compression.ZstdSpec org.apache.pekko.stream.io.compression.CompressionWithoutZstdSpec" (42 passed)
- sbt "++3.3.8 stream/compile"
- scalafmt on the changed Scala files

References:
Refs apache#3674, apache#3710
@pjfanning pjfanning added this to the 2.0.0-M5 milestone Oct 28, 2026

@danischroeter danischroeter left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@pjfanning
pjfanning merged commit 0ffecec into apache:main Oct 28, 2026
10 checks passed
@pjfanning
pjfanning deleted the zstd-jni-1.5.7-25 branch October 28, 2026 16:26
pjfanning added a commit to pjfanning/incubator-pekko that referenced this pull request Oct 28, 2026
pjfanning added a commit to pjfanning/incubator-pekko that referenced this pull request Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants