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

Add error handling for async errors in client #2984

Merged
merged 1 commit into from
Aug 24, 2023

Conversation

acolytec3
Copy link
Contributor

@acolytec3 acolytec3 commented Aug 23, 2023

Fixes #2983 as well as adds an additional layer of error handling to the client top-level run function for errors thrown in eventemitter functions (that normally bypass the run().catch... call).

You can test the fix for #2983 by starting geth with default settings and then try to start our client with same defaults. You will observe an error message like Server error - EADDRINUSE... or something indicating that geth is already listening on port 30303.

On master branch, once this error occurs, you will not be able to shut down the client using Ctrl + C because the client startup function hangs mid promise and never resolves. This handles the error gracefully and starts the client up. Oddly enough, the client seems to be able to use the port in contention and still be able to sync mainnet.

I also add some additional error handling for other (as yet unknown) errors thrown during async processes like EventEmitter events. This will log these errors and their stack trace to the console and then call the client shutdown function. If the client did not successfully start up and the clientStartPromise has hung, it will ungracefully terminate the client after 30 seconds.

@codecov
Copy link

codecov bot commented Aug 23, 2023

Codecov Report

Merging #2984 (5421704) into master (f5dcf4a) will increase coverage by 0.05%.
Report is 2 commits behind head on master.
The diff coverage is 93.75%.

❗ Current head 5421704 differs from pull request most recent head 479a21f. Consider uploading reports for the commit 479a21f to get more accurate results

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 88.66% <ø> (ø)
blockchain 92.58% <ø> (ø)
client 87.46% <93.75%> (+0.08%) ⬆️
common 98.56% <ø> (ø)
ethash ∅ <ø> (∅)
evm 70.43% <ø> (ø)
rlp ∅ <ø> (∅)
statemanager 84.43% <ø> (ø)
trie 89.78% <ø> (+0.25%) ⬆️
tx 95.88% <ø> (ø)
util 86.78% <ø> (ø)
vm 79.20% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

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

Ah, I find this pretty great, so from my side we can merge! ☺️

@holgerd77 holgerd77 force-pushed the better-error-handling branch from 5421704 to 479a21f Compare August 24, 2023 11:24
@holgerd77
Copy link
Member

Rebased this via UI

@holgerd77 holgerd77 merged commit 490b7a1 into master Aug 24, 2023
@holgerd77 holgerd77 deleted the better-error-handling branch August 24, 2023 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Client shutdown issues if RLPx port is in use
2 participants