DaemonManager: prevent GUI from hanging on hanging monerod
launch
#4244
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #4240
Problem 1
monerod
hangs on this line when creating an http connection (for localjson-rpc
):https://github.com/monero-project/monero/blob/ac02af92867590ca80b2779a7bbeafa99ff94dcb/src/common/rpc_client.h#L125
using the generic 3 minutes and 30 seconds connection timeout:
https://github.com/monero-project/monero/blob/ac02af92867590ca80b2779a7bbeafa99ff94dcb/src/common/http_connection.h#L42-L45
This causes direct
json-rpc
invocation (./monerod sync_info
) to hang for 3m30s before exiting ifmonerod
can't bind.Problem 2
Monero GUI relies on direct
json-rpc
invocation to tell ifmonerod
is "running":monero-gui/src/daemon/DaemonManager.cpp
Lines 239 to 245 in e9cd458
This causes the GUI to hang and the
Watcher
is not quite in sync so it'll hang (in 3m30s chunks) until the 2 miraculously sync up.Change
When launching
monerod
, launch it with a timeout of5 seconds
before assuming something has gone wrong and returnfalse
, as in we failed to launch.This lowers the "is monerod running?" poll-rate to every 5 seconds which makes the error screen surface around the
120s
mark as intended.