Opened 7 months ago

Closed 7 months ago

Last modified 7 months ago

#29078 closed defect (worksforme)

nyx values do differ from stem native example

Reported by: toralf Owned by: atagar
Priority: Medium Milestone:
Component: Core Tor/Nyx Version: Tor: 0.3.5.7
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

I do run 2 Tor relaays at the same hardware at 2 different ports. Netstat reports about 12,000 connections.
Stem 1.7.1 gives:

mr-fox ~ # for p in 9051 29051 ; do python /usr/share/doc/stem-1.7.1/_static/example/relay_connections.py --ctrlport $p; done
 0.3.5.7   uptime: 08:25:03   flags: Fast, Guard, Running, Stable, V2Dir, Valid

+------------------------------+------+------+
| Type                         | IPv4 | IPv6 |
+------------------------------+------+------+
| Inbound to our ORPort        | 2777 |    6 |
| Inbound to our DirPort       |    3 |    0 |
| Inbound to our ControlPort   |    1 |    0 |
| Outbound to a relay          | 3235 |    0 |
| Outbound uncategorized       |    8 |    0 |
+------------------------------+------+------+
| Total                        | 6024 |    6 |
+------------------------------+------+------+

 0.3.5.7   uptime: 08:25:05   flags: Fast, Guard, Running, Stable, V2Dir, Valid

+------------------------------+------+------+
| Type                         | IPv4 | IPv6 |
+------------------------------+------+------+
| Inbound to our ORPort        | 2866 |    2 |
| Inbound to our ControlPort   |    2 |    0 |
| Outbound to a relay          | 3447 |    0 |
| Outbound uncategorized       |   16 |    0 |
+------------------------------+------+------+
| Total                        | 6331 |    2 |
+------------------------------+------+------+

whilst nyx 2.0.4 gives:

sudo -u tor /bin/bash -c "/usr/bin/nyx -i 29051"
...
Connections (2853 inbound, 6690 outbound, 1 control):

and

sudo -u tor /bin/bash -c "/usr/bin/nyx -i 9051"
...
Connections (2787 inbound, 6694 outbound, 1 control):

respectively.

Child Tickets

Change History (7)

comment:1 Changed 7 months ago by atagar

Component: - Select a componentCore Tor/Nyx
Owner: set to atagar
Status: newneeds_information

Hi toralf. To start with please change Nyx's resolution method. By default it uses a method I call 'inference' which sidesteps DisableDebuggerAttachment but might be getting confused by having two tor relays present.

To change the method go to the connection page, press 'r', and select 'netstat'. Please also re-run the stem connection count with a '--resolver netstat' argument.

comment:2 Changed 7 months ago by toralf

The numbers of the stem example are correct and comparable for "--netstat", "--lsof" and "--proc".

For nyx the correct numbers are sonly hown (for "netstat", "ss" and "proc") if I press "r" before the first time the connection page was filled (which usually needs 20 sec). If however the connections are shown then pressing "r" doesn't have any visible effect for no choosen resolver.

The error in that case still looks like that the inbound number aren't subtracted from the outbound number (which seems to be the sum of both isntead of the outbound only).

Last edited 7 months ago by toralf (previous) (diff)

comment:3 Changed 7 months ago by atagar

If however the connections are shown then pressing "r" doesn't have any visible effect for no choosen resolver.

That makes sense to some extent. If you wait long enough the numbers will correct themselves. Nyx slows down the rate at which it polls connection data when it takes a long time to get results so we don't put an overdue burden on your system...

https://gitweb.torproject.org/nyx.git/tree/nyx/tracker.py#n569

If it takes 20 seconds to query connection data then Nyx will back off so it only polls connection data every 2,000 seconds (every half hour). That said, Nyx should only do so after making three highly burdensome requests.

Logging at a debug runlevel will tell you how long queries take to complete and when Nyx reduces its poll rate.

The error in that case still looks like that the inbound number aren't subtracted from the outbound number

Sorry, without a local reproduction of an issue I can't really dig in. I just took a peek at the panel title stats and it looks right to me (not spotting any double counting).

If you pause Nyx (so the panel does not populate with new connections) then count the number of connections labeled 'inbound' and 'outbound' shown in the panel are you saying that number does not match the panel title?

comment:4 Changed 7 months ago by toralf

Seems that counting works for every resolver long as I do pause nyx and choose any resolver and do continue.

comment:5 Changed 7 months ago by atagar

Resolution: worksforme
Status: needs_informationclosed

Gotcha, thanks toralf.

comment:6 Changed 7 months ago by toralf

Hhm, might be the bug is lcoal specific, but...
Did you tried to reproduced the bug at your system with a number of connection > 9999 ?

IIRC there was a bug in parsing 5-digit numbers of connection lists in an example script too?

comment:7 Changed 7 months ago by atagar

Hi toralf. Nope, none of my systems have such high connection load.

I'd rather not put further time into speculation. If you have a problem I can reproduce locally I'm happy to take a peek but otherwise I'll need to go with 'patches welcome'.

Note: See TracTickets for help on using tickets.