monero-gui
monero-gui copied to clipboard
DaemonManager: prevent GUI from hanging on hanging `monerod` launch
Fixes https://github.com/monero-project/monero-gui/issues/4240
Problem 1
monerod
hangs on this line when creating an http connection (for local json-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 if monerod
can't bind.
Problem 2
Monero GUI relies on direct json-rpc
invocation to tell if monerod
is "running":
https://github.com/monero-project/monero-gui/blob/e9cd4588aef3f0808ce153957a504f43dcdbeb26/src/daemon/DaemonManager.cpp#L239-L245
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 of 5 seconds
before assuming something has gone wrong and return false
, 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.
could you help me reproduce the issue? i had first tried to bind a monero-wallet-rpc client to the same port the 'launched by monero-gui' monerod would attempt to use for its --zmq-port, but i noticed the 120 second timeout
- Block port 18081/18083
- Start
monerod
from Monero GUI with no special arguments - See no error after 120 second timeout
https://github.com/monero-project/monero-gui/assets/101352116/fe073827-4bb2-4f62-9704-0a26b6258546
$ nc -lp 18081 > /dev/null
i still see the failed to start after 120 seconds, but im half certain i experienced a loop longer than 120 , strange (would this be me encountering the 3 min 30 second timeout?) Screencast from 15-01-24 08:16:14.webm