Skip to content

bugfix: use service port for naming server control metadata#8128

Open
skt-shinyruo wants to merge 9 commits into
apache:2.xfrom
skt-shinyruo:fix-issue-8110-control-port
Open

bugfix: use service port for naming server control metadata#8128
skt-shinyruo wants to merge 9 commits into
apache:2.xfrom
skt-shinyruo:fix-issue-8110-control-port

Conversation

@skt-shinyruo

Copy link
Copy Markdown

Summary

  • use XID.getPort() instead of server.port when registering naming server control metadata in the general and raft instance strategies
  • align RaftStateMachine metadata sync paths so leader metadata and current node sync both publish the service port for control
  • add regression coverage for the control port behavior and restore shared state in the affected tests

Fixes #8110.

Test Plan

  • ./mvnw -pl server -DskipITs -Dtest=GeneralInstanceStrategyTest,RaftServerInstanceStrategyTest,RaftStateMachineTest test

@funky-eyes funky-eyes requested a review from Copilot June 9, 2026 06:05
@funky-eyes funky-eyes added first-time contributor first-time contributor module/server server module type: bug Category issues or prs related to bug. labels Jun 9, 2026
@funky-eyes funky-eyes added this to the 2.8.0 milestone Jun 9, 2026
@funky-eyes funky-eyes changed the title fix: use service port for naming server control metadata bugfix: use service port for naming server control metadata Jun 9, 2026

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 PR fixes how Seata server instances publish their control endpoint port to the naming server by using the Seata service port (XID.getPort()) instead of Spring’s server.port, preventing naming server request forwarding to a non-listening port (Fixes #8110).

Changes:

  • Switch control endpoint port selection to XID.getPort() in both General and Raft instance strategies.
  • Align Raft leader metadata publishing and current-node metadata sync to publish the service port for control.
  • Add/adjust regression tests to validate the control port behavior and restore shared singleton/environment state between tests.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
server/src/main/java/org/apache/seata/server/instance/GeneralInstanceStrategy.java Publish control endpoint using XID.getPort() instead of server.port.
server/src/main/java/org/apache/seata/server/instance/RaftServerInstanceStrategy.java Publish control endpoint using XID.getPort() instead of server.port.
server/src/main/java/org/apache/seata/server/cluster/raft/RaftStateMachine.java Use service port for control metadata in leader metadata and current-node sync paths.
server/src/test/java/org/apache/seata/server/instance/GeneralInstanceStrategyTest.java New regression test ensuring control endpoint uses service port; restores shared state.
server/src/test/java/org/apache/seata/server/instance/RaftServerInstanceStrategyTest.java Update regression to assert control endpoint uses service port; restores shared state.
server/src/test/java/org/apache/seata/server/cluster/raft/RaftStateMachineTest.java Add regression tests validating metadata uses service port for control; cleans up RouteTable and environment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.81%. Comparing base (b57d96c) to head (b64577e).

Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #8128      +/-   ##
============================================
+ Coverage     72.79%   72.81%   +0.01%     
  Complexity     1141     1141              
============================================
  Files          1151     1151              
  Lines         42272    42272              
  Branches       5045     5045              
============================================
+ Hits          30773    30780       +7     
+ Misses         9023     9019       -4     
+ Partials       2476     2473       -3     

see 5 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first-time contributor first-time contributor module/server server module type: bug Category issues or prs related to bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

namingServer转发请求到seata-server:v2.6.0

4 participants