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

DaemonManager: prevent GUI from hanging on hanging monerod launch #4244

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hinto-janai
Copy link

Fixes #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":

bool DaemonManager::running(NetworkType::Type nettype, const QString &dataDir) const
{
QString status;
sendCommand({"sync_info"}, nettype, dataDir, status);
qDebug() << status;
return status.contains("Height:");
}

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.

@plowsof
Copy link
Contributor

plowsof commented Nov 17, 2023

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

@hinto-janai
Copy link
Author

  1. Block port 18081/18083
  2. Start monerod from Monero GUI with no special arguments
  3. See no error after 120 second timeout
120.mp4

@plowsof
Copy link
Contributor

plowsof commented Jan 15, 2024

$ 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

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.

GUI hangs if monerod cannot bind
2 participants