Skip to content

aggressive timeouts ignore max rpc connections value #11011

Description

@plowsof

for example i have --rpc-max-connections-per-private-ip=200 on my tor nodes (so every host is 127.0.0.1). when trying to sync old wallets i can barely connect and the node appears offline. more recent wallets are able to connect reliably. after seeing boog900's latest research in this commemt and asking them about how monerod caches commonly scanned blocks it connected the dots for me, that there is some timeout issue.

related constants:

#define AGGRESSIVE_TIMEOUT_THRESHOLD 120 // sockets
#define NEW_CONNECTION_TIMEOUT_LOCAL 1200000 // 2 minutes
#define NEW_CONNECTION_TIMEOUT_REMOTE 10000 // 10 seconds
#define DEFAULT_TIMEOUT_MS_LOCAL 1800000 // 30 minutes
#define DEFAULT_TIMEOUT_MS_REMOTE 300000 // 5 minutes

related code: (further research required)

template<typename T>
typename connection<T>::duration_t connection<T>::get_default_timeout()
{
unsigned count{};
try { count = host_count(); } catch (...) {}
const unsigned shift = (
connection_basic::get_state().sock_count > AGGRESSIVE_TIMEOUT_THRESHOLD ?
std::min(std::max(count, 1u) - 1, 8u) :
0
);
return (
m_local ?
std::chrono::milliseconds(DEFAULT_TIMEOUT_MS_LOCAL >> shift) :
std::chrono::milliseconds(DEFAULT_TIMEOUT_MS_REMOTE >> shift)
);
}
)

i don't know exactly how these limits negatively effect but they appear to have no connection to the max connection values

also to consider / todo: can we remove these timeouts entirely for localhost (tor) and rely on tors proof of work defence for new connections? (.. docs)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions