Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(backup): make SR node with backup exit normally by kill -15 #5868

Merged

Conversation

halibobo1205
Copy link
Contributor

@halibobo1205 halibobo1205 commented Jun 20, 2024

What does this PR do?
Make the thread pool close after the netty channel closes.
Why are these changes required?
Make the SR node with backup to be stopped normally by kill -15.

channel.closeFuture().sync(); //  wait for the main channel (listening socket) to shutdown (closeFuture().sync()) where closeFuture gives you the "future" on "close" operation (meaning shutdown of the server socket), and sync waiting for this future to be done.
image

As shown below, the thread pool is closed first, and then the channel is closed. the thread can not exit because it is synchronized waiting for the channel close event, which prevents the thread pool from closing properly.
image

Finally, after 60 seconds of waiting, the thread pool is forced to close.
image

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

@halibobo1205 halibobo1205 force-pushed the feat/backup_thead_pool_close_opt branch from 271a64c to 6550dfb Compare June 20, 2024 10:45
@halibobo1205 halibobo1205 changed the title fix(backup/backupServer): make the thread pool close after the netty channel closes fix(backup/backupServer): make the SR node that enables backup can be stopped normally by kill -15 Jun 20, 2024
@halibobo1205 halibobo1205 changed the title fix(backup/backupServer): make the SR node that enables backup can be stopped normally by kill -15 fix(backup): make the SR node that enables backup can be stopped normally by kill -15 Jun 20, 2024
@halibobo1205 halibobo1205 changed the title fix(backup): make the SR node that enables backup can be stopped normally by kill -15 fix(backup): make the SR node that enables backup exit normally with kill-15 Jun 20, 2024
@halibobo1205 halibobo1205 changed the title fix(backup): make the SR node that enables backup exit normally with kill-15 fix(backup): make SR node enabling backup exit normally by kill -15 Jun 21, 2024
@halibobo1205 halibobo1205 changed the title fix(backup): make SR node enabling backup exit normally by kill -15 fix(backup): make SR node with backup exit normally by kill -15 Jun 21, 2024
@lvs007 lvs007 merged commit 143a456 into tronprotocol:develop Jul 1, 2024
7 checks passed
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.

4 participants