Skip to content

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

Merged
ahmedmuhsin merged 4 commits into
Azure:devfrom
ahmedmuhsin:fix/grpc-netty-shaded-bump-java25
Jun 3, 2026
Merged

Bump grpc-java to 1.81.0 to silence Java 25 Unsafe deprecation warning#873
ahmedmuhsin merged 4 commits into
Azure:devfrom
ahmedmuhsin:fix/grpc-netty-shaded-bump-java25

Conversation

@ahmedmuhsin

@ahmedmuhsin ahmedmuhsin commented May 15, 2026

Copy link
Copy Markdown
Collaborator

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.
gavin-aguiar
gavin-aguiar previously approved these changes May 19, 2026
Comment thread pom.xml
<mockito-core.version>4.11.0</mockito-core.version>
<appinsights.agents.version>3.7.6</appinsights.agents.version>
<grpc.version>1.75.0</grpc.version>
<grpc.version>1.81.0</grpc.version>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you also need to update protobuf to a compatible version?

Bumps protobuf-java (and the matching protoc artifact used by protobuf-maven-plugin) from 3.25.5 to 3.25.8. Same minor (3.25.x), patch-level fixes only, fully compatible with grpc-protobuf 1.81.0 which declares 3.25.5 as the minimum.
@ahmedmuhsin

Copy link
Copy Markdown
Collaborator Author

@gavin-aguiar Good call. grpc-protobuf 1.81.0 declares protobuf-java 3.25.5 as the minimum, so we were technically compatible already, but I went ahead and bumped to the latest 3.25.x patch (3.25.8) for hygiene. Updated both protobuf-java and the matching protoc artifact in protobuf-maven-plugin. Build + unit tests still pass.

@ahmedmuhsin
ahmedmuhsin merged commit 00ce273 into Azure:dev Jun 3, 2026
19 checks passed
ahmedmuhsin added a commit that referenced this pull request Jul 24, 2026
#873)

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

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.

* Bump protobuf-java and protoc to 3.25.8

Bumps protobuf-java (and the matching protoc artifact used by protobuf-maven-plugin) from 3.25.5 to 3.25.8. Same minor (3.25.x), patch-level fixes only, fully compatible with grpc-protobuf 1.81.0 which declares 3.25.5 as the minimum.
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