Skip to content

feature: upgrade Netty to 4.2.15.Final - #8209

Open
xjlgod wants to merge 8 commits into
apache:2.xfrom
xjlgod:feature/netty-4.2.15
Open

feature: upgrade Netty to 4.2.15.Final#8209
xjlgod wants to merge 8 commits into
apache:2.xfrom
xjlgod:feature/netty-4.2.15

Conversation

@xjlgod

@xjlgod xjlgod commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Ⅰ. Describe what this PR did

  • Upgrade Netty from 4.1.137.Final to 4.2.15.Final through the Netty BOM.
  • Migrate Seata transport event loops from deprecated Netty 4.1 APIs to the Netty 4.2 IoHandler / MultiThreadIoEventLoopGroup APIs.
  • Keep the allocator explicitly configured as pooled, and remove use of Netty internal APIs.
  • Ensure Seata's Netty BOM takes precedence over Spring Boot dependency management in server-related modules.
  • Align related gRPC/Protobuf dependency management and add required direct Netty dependencies for the SkyWalking plugin.
  • Update the gRPC interceptor test to use an actual grpc-netty TCP server and client.
  • Add Chinese and English change-log entries under changes/.

Ⅱ. Does this pull request fix one issue?

No.

Ⅲ. Why don't you add test cases (unit test/integration test)?

N/A. This PR updates existing tests and executes the relevant test suites.

In particular, GrpcTest was migrated from the in-process transport to a real grpc-netty TCP transport, so the test now verifies the Netty-based gRPC request path. Existing core remoting, HTTP/2, Etcd registry, and version-compatibility tests were also executed.

Ⅳ. Describe how to verify it

  1. Run the relevant unit tests on JDK 8:

    • Core Netty remoting, HTTP/2 handler, channel event, and Netty client bootstrap tests.
    • Etcd registry tests.
    • extensions/rpc/seata-grpc interceptor tests.
  2. Run the cross-version compatibility tests on JDK 21:

    • Verify client/server combinations across the old and new versions.
  3. Build the release distribution with JDK 25 and the release-seata profile.

  4. Inspect the generated server and naming-server distributions:

    • All bundled Netty artifacts must resolve to 4.2.15.Final.
    • No netty-4.1.x artifacts should remain.
    • Startup scripts must retain -Dio.netty.allocator.type=pooled.

Ⅴ. Special notes for reviews

  • Netty 4.2 is not intended to coexist with Netty 4.1 in the same runtime classpath. This PR centralizes version resolution through the Netty BOM and overrides Spring Boot-managed Netty versions where necessary.
  • The migration is intentionally scoped to deprecated event-loop APIs and direct internal-API usage; business protocol behavior is unchanged.
  • The SkyWalking plugin now declares direct provided Netty dependencies because it directly uses Netty Channel and AttributeMap types.

@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.38%. Comparing base (41694e1) to head (94ece23).

Files with missing lines Patch % Lines
...che/seata/core/rpc/netty/NettyClientBootstrap.java 66.66% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #8209      +/-   ##
============================================
+ Coverage     73.22%   73.38%   +0.15%     
- Complexity     1146     1147       +1     
============================================
  Files          1153     1153              
  Lines         42348    42359      +11     
  Branches       5061     5061              
============================================
+ Hits          31011    31085      +74     
+ Misses         8852     8803      -49     
+ Partials       2485     2471      -14     
Files with missing lines Coverage Δ
...g/apache/seata/config/etcd3/EtcdConfiguration.java 46.44% <100.00%> (ø)
...che/seata/core/protocol/detector/HttpDetector.java 82.50% <100.00%> (+0.92%) ⬆️
...g/apache/seata/core/rpc/netty/NettyBaseConfig.java 75.75% <100.00%> (+3.03%) ⬆️
...che/seata/core/rpc/netty/NettyServerBootstrap.java 70.87% <100.00%> (+17.26%) ⬆️
...che/seata/core/rpc/netty/NettyClientBootstrap.java 62.88% <66.66%> (+8.63%) ⬆️

... and 20 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@xjlgod
xjlgod marked this pull request as ready for review August 22, 2026 14:07
@xjlgod
xjlgod requested a lite review from Copilot August 22, 2026 14:07

Copilot AI left a comment

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.

Pull request overview

This pull request upgrades Seata’s Netty stack to 4.2.15.Final via a centralized BOM and migrates the transport event-loop implementation from deprecated Netty 4.1 APIs to the Netty 4.2 IoHandler / MultiThreadIoEventLoopGroup APIs. It also updates dependency management precedence (notably for Spring Boot–managed modules), adjusts distribution startup scripts to keep pooled allocator settings explicit, and refreshes/extends tests to validate the new Netty-based behavior paths.

Changes:

  • Upgrade Netty to 4.2.15.Final and enforce alignment via BOM imports + Maven Enforcer convergence for io.netty:*.
  • Migrate server/client event loops to MultiThreadIoEventLoopGroup + NioIoHandler / EpollIoHandler, and explicitly configure pooled allocators at runtime.
  • Update tests (including gRPC interceptor tests) and distribution scripts to reflect the new transport/runtime settings.

Reviewed changes

Copilot reviewed 20 out of 24 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test-suite/test-new-version/src/test/java/org/apache/seata/core/rpc/netty/v1/ProtocolV1Server.java Updates compatibility test server to Netty 4.2 event loop group + IO handler APIs.
test-suite/test-new-version/src/test/java/org/apache/seata/core/rpc/netty/v1/ProtocolV1Client.java Updates compatibility test client to Netty 4.2 event loop group + IO handler APIs.
test-suite/test-new-version/src/test/java/org/apache/seata/core/rpc/netty/multiversion/AbstractMultiVersionCompatibilityTest.java Migrates multiversion test event loops to Netty 4.2 IO handler model.
server/pom.xml Imports Netty BOM ahead of other BOMs to ensure Netty version precedence.
namingserver/pom.xml Imports Netty BOM ahead of Spring Boot BOM to avoid Netty version drift.
mock-server/pom.xml Imports Netty BOM ahead of Spring Boot BOM to keep Netty aligned.
extensions/rpc/seata-grpc/src/test/java/org/apache/seata/integration/grpc/interceptor/GrpcTest.java Moves interceptor test to real grpc-netty TCP transport and JUnit Jupiter lifecycle.
extensions/apm/apm-seata-skywalking-plugin/pom.xml Adds direct provided Netty dependencies required by the plugin’s Netty API usage.
distribution/bin/seata-setup.sh Ensures pooled allocator system property is set in server setup script.
distribution/bin/seata-server.bat Ensures pooled allocator system property is set in Windows server launcher.
distribution/bin/seata-namingserver.bat Ensures pooled allocator system property is set in Windows namingserver launcher.
distribution/bin/seata-namingserver-setup.sh Ensures pooled allocator system property is set in namingserver setup script.
dependencies/pom.xml Adds Netty BOM import in dependency management for unified Netty 4.2 module alignment.
core/src/test/java/org/apache/seata/core/rpc/netty/NettyServerBootstrapTest.java Adds coverage asserting server uses Netty 4.2 MultiThreadIoEventLoopGroup when epoll disabled.
core/src/test/java/org/apache/seata/core/rpc/netty/NettyClientBootstrapTest.java Extends coverage for pooled allocator option and Netty 4.2 event loop group selection.
core/src/test/java/org/apache/seata/core/rpc/netty/ChannelEventHandlerIntegrationTest.java Migrates integration test event loops to Netty 4.2 IO handler model.
core/src/main/java/org/apache/seata/core/rpc/netty/NettyServerBootstrap.java Migrates server event loops to Netty 4.2 APIs and explicitly sets pooled allocators on channels.
core/src/main/java/org/apache/seata/core/rpc/netty/NettyClientBootstrap.java Migrates client event loops to Netty 4.2 APIs and explicitly sets pooled allocator + improved epoll fallback logging.
core/src/main/java/org/apache/seata/core/rpc/netty/NettyBaseConfig.java Simplifies epoll selection logic around Epoll.isAvailable().
core/src/main/java/org/apache/seata/core/protocol/detector/HttpDetector.java Adds bounds check to prevent prefix scan on insufficient readable bytes.
config/seata-config-etcd3/src/main/java/org/apache/seata/config/etcd3/EtcdConfiguration.java Removes Netty internal ConcurrentSet usage in favor of ConcurrentHashMap.newKeySet().
changes/zh-cn/2.x.md Adds changelog entry and contributor acknowledgement for the Netty upgrade.
changes/en-us/2.x.md Adds changelog entry and contributor acknowledgement for the Netty upgrade.
build/pom.xml Defines netty.version=4.2.15.Final, upgrades enforcer plugin, and enforces Netty dependency convergence.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@xjlgod
xjlgod requested review from Bughue and funky-eyes August 22, 2026 14:19

@WangzJi WangzJi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you confirm whether seata-console also needs to be aligned with Netty 4.2.15? Under the source-release profile, its effective dependency tree still resolves io.netty:* to 4.2.12.Final via Spring Boot 4.0.6. If only the final server/namingserver distributions need alignment and they already resolve to 4.2.15, no change is needed; otherwise, console should import the Netty BOM before Spring Boot as well.

@funky-eyes funky-eyes added this to the 2.8.0 milestone Aug 28, 2026
@funky-eyes funky-eyes added module/core core module type: feature Category issues or prs related to feature request. labels Aug 28, 2026
@funky-eyes
funky-eyes requested a balanced review from Copilot August 28, 2026 07:12

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 20 out of 24 changed files in this pull request and generated 1 comment.

Comment thread build/pom.xml
<spotless-maven-plugin.version>2.44.3</spotless-maven-plugin.version>
<palantirJavaFormat.version>2.38.0</palantirJavaFormat.version>
<maven-enforcer-plugin.version>3.0.0-M3</maven-enforcer-plugin.version>
<maven-enforcer-plugin.version>3.6.3</maven-enforcer-plugin.version>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module/core core module type: feature Category issues or prs related to feature request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants