Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@funky-eyes
Copy link
Contributor

@funky-eyes funky-eyes commented Oct 30, 2023

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

fixes #5976

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

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@funky-eyes funky-eyes added this to the 2.0.0 milestone Oct 30, 2023
@funky-eyes funky-eyes added type: bug Category issues or prs related to bug. module/server server module labels Oct 30, 2023
@funky-eyes funky-eyes changed the title bugfix: fix that rpcserver is not closed when raftServer is closed bugfix: fix that rpcServer is not closed when raftServer is closed Oct 30, 2023
@codecov
Copy link

codecov bot commented Oct 30, 2023

Codecov Report

Merging #5977 (cc1ed6c) into 2.x (773631e) will increase coverage by 0.02%.
The diff coverage is 63.63%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #5977      +/-   ##
============================================
+ Coverage     48.05%   48.08%   +0.02%     
- Complexity     4611     4614       +3     
============================================
  Files           911      911              
  Lines         31285    31287       +2     
  Branches       3768     3767       -1     
============================================
+ Hits          15034    15044      +10     
+ Misses        14736    14728       -8     
  Partials       1515     1515              
Files Coverage Δ
...in/java/io/seata/server/session/SessionHolder.java 43.97% <100.00%> (+0.13%) ⬆️
.../java/io/seata/server/cluster/raft/RaftServer.java 0.00% <0.00%> (ø)
...o/seata/server/cluster/raft/RaftServerFactory.java 21.42% <66.66%> (+3.65%) ⬆️

... and 2 files with indirect coverage changes

LOGGER.error(e.getMessage());
}
}
RaftServerFactory.getInstance().destroy();
Copy link
Member

Choose a reason for hiding this comment

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

In the future, it is necessary to refactor the code to decouple SessionHolder with RaftXXX.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the future, it is necessary to refactor the code to decouple SessionHolder with RaftXXX.

Since the raft cluster must match the raft mode exactly, it must be written in the sessionHolder, otherwise the timing of the initialization is not very controllable, and the raft cluster must be started after the sessionmanager has finished initializing, otherwise there may be npe issues

}

@Override
public void close() {
Copy link
Member

Choose a reason for hiding this comment

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

The general purpose of the Java Factory class is to create and return objects of other classes, not to control behavior. If rpcServer is part of RaftServer, then it is more appropriate to control behavior in RaftServer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The general purpose of the Java Factory class is to create and return objects of other classes, not to control behavior. If rpcServer is part of RaftServer, then it is more appropriate to control behavior in RaftServer.

A single rpc server can be used by multiple raft servers, so all raft servers should be controlled in the raft server factory, as well as their behavior when destroyed.

Copy link
Contributor

@leizhiyuan leizhiyuan left a comment

Choose a reason for hiding this comment

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

LGTM

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

Labels

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.

raftserver in SessionHolder can not be destroyed correctly

3 participants