Skip to content

Bump grpc-java to 1.81.0 to silence Java 25 Unsafe deprecation warning#873

Open
ahmedmuhsin wants to merge 1 commit into
Azure:devfrom
ahmedmuhsin:fix/grpc-netty-shaded-bump-java25
Open

Bump grpc-java to 1.81.0 to silence Java 25 Unsafe deprecation warning#873
ahmedmuhsin wants to merge 1 commit into
Azure:devfrom
ahmedmuhsin:fix/grpc-netty-shaded-bump-java25

Conversation

@ahmedmuhsin
Copy link
Copy Markdown
Contributor

@ahmedmuhsin ahmedmuhsin commented May 15, 2026

Why

Running the worker on Java 25 produces these warnings on startup:

WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::allocateMemory has been called by com.microsoft.azure.functions.shaded.io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0$2 (file:/.../azure-functions-java-worker.jar)
WARNING: Please consider reporting this to the maintainers of class com.microsoft.azure.functions.shaded.io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0$2
WARNING: sun.misc.Unsafe::allocateMemory will be removed in a future release

The warning comes from the shaded Netty inside grpc-netty-shaded (Netty 4.1.118.Final ships inside grpc-java 1.75.0). Netty 4.1.x calls the now terminally-deprecated sun.misc.Unsafe::allocateMemory for direct-buffer allocation; JDK 23+ flagged that method, and JDK 25 prints the warning on startup.

What

Bumps grpc.version from 1.75.01.81.0 (latest stable). That pulls in shaded Netty 4.1.132.Final, which routes direct-buffer allocation away from the deprecated method, so the warning disappears with no code or launch-argument changes.

Before After
grpc-java 1.75.0 1.81.0
shaded Netty 4.1.118.Final 4.1.132.Final

Java 8 compatibility

grpc-java 1.81.0 still targets Java 8 bytecode and ships with animal-sniffer checks intact (visible in the dependency tree), so this keeps the worker compatible with the full Java 8 → 25 range we support.

Verification

  • mvn clean package -DskipTests succeeds; uber-jar correctly bundles grpc-*-1.81.0 and grpc-netty-shaded-1.81.0.
  • mvn test: 63/63 tests pass, no regressions.
  • Manual smoke run on Java 25 — the sun.misc.Unsafe::allocateMemory warning no longer appears.

Bumps io.grpc:grpc-netty-shaded (and grpc-protobuf, grpc-stub, protoc-gen-grpc-java) from 1.75.0 to 1.81.0, which pulls in shaded Netty 4.1.132. The previous shaded Netty (4.1.118 inside grpc-java 1.75.0) called the now terminally-deprecated sun.misc.Unsafe::allocateMemory, producing noisy warnings on JDK 23+ (and especially JDK 25). Netty 4.1.124+ routes direct-buffer allocation away from the deprecated method, so the warning goes away without any code or launch-argument changes.

grpc-java 1.81.0 still targets Java 8 bytecode (animal-sniffer is still on the dependency tree), so this preserves Java 8 compatibility for the worker.
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.

1 participant