Skip to content

Ethereum Stop Sequence#4161

Open
MicahMaphet wants to merge 1 commit into
bitpay:masterfrom
MicahMaphet:eth-stop
Open

Ethereum Stop Sequence#4161
MicahMaphet wants to merge 1 commit into
bitpay:masterfrom
MicahMaphet:eth-stop

Conversation

@MicahMaphet
Copy link
Copy Markdown
Contributor

🛑 Description

Previously when using ethereum on bitcore-node, the server would never stop. This was caused by the ethereum rpcs not stopping. This solves this by tearing down the rps with a delay of 100 ms, which prevents errors.
Currently, with ethereum it still has an exit code of 1. This is unsolved.

🪵 Changelog

  • Tear down rpcs when ethereum workers start with a 100ms delay

🧪 Testing Notes

Tested with a bitcore.config.json that only uses ethereum.
Run, and stop on master and eth-stop:

$ npm run p2p
[press ^C after ETH:regtest up to date message]
info :: 2026-05-08T06:27:30.011Z :: ETH:regtest up to date.
^Cinfo :: 2026-05-08T06:27:33.530Z :: Shutting down P2P pid 55016

Checklist

  • I have read CONTRIBUTING.md and verified that this PR follows the guidelines and requirements outlined in it.

this.multiThreadSync.stop();
logger.debug(`Stopping worker for chain ${this.chain} ${this.network}`);
await this.disconnect();
setTimeout(BaseEVMStateProvider.teardownRpcs, 100);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why the setTimeout?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It would crash the other services if done immediately.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Then it seems this is in the wrong place. We should call teardownRpcs after the other services are stopped.

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