View Issue Details

IDProjectCategoryView StatusLast Update
0006468unrealircdpublic2024-09-08 20:07
Reportersyzop Assigned Tosyzop  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version6.1.7.2 
Fixed in Version6.1.8 
Summary0006468: c-ares ignores timeout
DescriptionI just had a localhost connection that didn't make it through... happened twice... it ends after 30 seconds or so with Registration timeout.
Upon further investigation CLIENT_FLAG_DNSLOOKUP is set, so it is hanging on DNS lookup.. apparently for a very very long time.

I remember reading that newer c-ares versions no longer take the timeout values as a given but "as a hint" and then "apply heuristics"... well... i guess that is this :D

c-ares 1.31.0
TagsNo tags attached.
3rd party modules

Activities

syzop

2024-09-08 19:07

administrator   ~0023333

So ARES_OPT_TIMEOUTMS int timeout; As of c-ares 1.32.0, this option is only honored on the first successful query to any given server, after that the timeout is automatically calculated based on prior query history.

And there's a new ARES_OPT_MAXTIMEOUTMS int maxtimeout;
The upper bound for timeout between sequential retry attempts. When retrying queries, the timeout is increased from the requested timeout parameter, this caps the value.

We should start using that ARES_OPT_MAXTIMEOUTMS.

Although do note that 1.32.3 changelog contains this entry/fix: ARES_OPT_MAXTIMEOUTMS wasn’t being honored in all cases.

Nice!

syzop

2024-09-08 19:33

administrator   ~0023334

While the title of this bug report is correct, the reason it hanged was my fault, not c-ares. Well, their query cache caused code path changes -g-

syzop

2024-09-08 20:07

administrator   ~0023335

Fixed in https://github.com/unrealircd/unrealircd/commit/bd5c5ca59e16a82197c78cddd4638e4b558ce2e9
Turn off query cache (added in c-ares 1.31.0), as we already have our own DNS cache for client lookups (ip->host->ip).

commit bd5c5ca59e16a82197c78cddd4638e4b558ce2e9 (HEAD -> unreal60_dev, origin/unreal60_dev, origin/HEAD)
Author: Bram Matthys <[email protected]>
Date: Sun Sep 8 19:38:10 2024 +0200

    In some situations users would hang during the handshake due to forever
    waiting DNS lookups. This had to do with c-ares query cache causing a
    different (unexpected) code path in UnrealIRCd.
    And, somewhat related, c-ares also didn't obey our DNS timeout, as that
    value is a "hint" nowadays, so now we set the "max timeout" value.
    
    Fun.

Issue History

Date Modified Username Field Change
2024-09-08 19:05 syzop New Issue
2024-09-08 19:05 syzop Assigned To => syzop
2024-09-08 19:05 syzop Status new => confirmed
2024-09-08 19:07 syzop Note Added: 0023333
2024-09-08 19:33 syzop Note Added: 0023334
2024-09-08 20:07 syzop Status confirmed => resolved
2024-09-08 20:07 syzop Resolution open => fixed
2024-09-08 20:07 syzop Fixed in Version => 6.1.8
2024-09-08 20:07 syzop Note Added: 0023335