Not all interfaces display when >~30 interfaces

Bug #1487190 reported by JuanJo Ciarlante
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
nicstat (Debian)
New
Unknown
nicstat (Ubuntu)
Triaged
Low
Unassigned

Bug Description

nicstat falsely assumes that a single read from /proc/net/dev
will return all its content (even if using a ~large buffer, 128K)

Revision history for this message
JuanJo Ciarlante (jjo) wrote :

fixed by https://github.com/jjo/nicstat/commit/3c2407da66c2fd2914e7f362f41f729cc21ff1e4,
see strace comparison (stock vs compiled with above) at a host
with ~270 interfaces:
http://paste.ubuntu.com/12137566/

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in nicstat (Ubuntu):
status: New → Confirmed
Revision history for this message
Robie Basak (racb) wrote :

This should get fixed in Debian and then we can sync. Since >30 interfaces is presumably an uncommon use case, Importance -> Low.

tags: added: needs-upstream-report
Changed in nicstat (Ubuntu):
importance: Undecided → Low
status: Confirmed → Triaged
Revision history for this message
Joshua Powers (powersj) wrote :
Changed in nicstat (Ubuntu):
status: Triaged → In Progress
assignee: nobody → Joshua Powers (powersj)
tags: added: patch
Joshua Powers (powersj)
summary: - nicstat fails on more than ~30 interfaces
+ Not all interfaces display when >~30 interfaces
Joshua Powers (powersj)
tags: removed: needs-upstream-report
Changed in nicstat (Debian):
status: Unknown → New
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "buffer_increase.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

Joshua Powers (powersj)
Changed in nicstat (Ubuntu):
status: In Progress → Confirmed
assignee: Joshua Powers (powersj) → nobody
Haw Loeung (hloeung)
Changed in nicstat (Debian):
importance: Unknown → Low
Changed in nicstat (Debian):
importance: Low → Unknown
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Hi,
I come by trying to identify old cases that got forgotten too long.

Patch on a plate - thanks JuanJo btw! - but all is stalled for way too long.
Debian maintainer was actually James Troup who didn't and won't update it.
There is no real upstream project behind this it seems.

But It seems nothing moves at all on this case.

OTOH we have the old blog that inspired it is dead.
This is in the crypt of bgregg here:
https://www.brendangregg.com/k9toolkit.html

There are two things to be done here IMHO:

1. Fix it!
On one hand we have waited for others too long already, the patch seems fine let us at least fix Kinetic and onwards (there are no updated, so this isn't a maintenance burden).
  - We might have one or the teams DDs fix it in Debian as NMU so that they benefit as well.

2. in Main?
But being so much out of date I wonder why that is in main at all nowadays
   Not here
    $ reverse-depends --release=kinetic nicstat
    No reverse dependencies found
  Not there
    $ seeded-in-ubuntu nicstat
    nicstat's binaries are not seeded.
  It is only in via [1] which I think it is time to drop.

  Functionality wise this is mostly covered by sysstat
  which is in main.
  It has r/w split of pkg/kb per second.
  One can (if ever needed) calculate the avg thereof.
  And utilization nowadays is misleading at best, have you ever
  compared a 100G interface net speed and real speed, this will
  in the future always be so low that it won't be very helpful.

  In universe there are more - similarly
  unmaintained iftop, ifstat, ...

[1]: https://people.canonical.com/~ubuntu-archive/germinate-output/ubuntu.jammy/rdepends/nicstat/nicstat

tags: added: server-todo
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Oh and if after all the time this still is important for bootstack, then please:

a) speak up why and why there are no alternatives?
b) why it wasn't driven/pushed any further since back then?

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

FYI:
- Proposed a seed change for the demotion.
- Added a tag to assign someone from the team later this week.

tags: added: bitesize
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Seed change landed, the fix is not important (after all so many years nobody else cared), but still a great bitesize task for someone that wants to just start improving things.

Changed in nicstat (Ubuntu):
assignee: nobody → Michał Małoszewski (michal-maloszewski99)
Changed in nicstat (Ubuntu):
status: Confirmed → In Progress
Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

Start working on it since 17.06.2022.
First step - dive into that topic and review comments here.
Next steps in comments.

Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

Looks like a patch has applied a regression.
Next step: code investigation and testing.

Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

The patch given indeed fixes the bug in Kinetic successfully, but it is not really complete and professional. I mean that the buffer size is still limited, but larger than it was before.

In my opinion dynamically allocating the buffer and resizing with realloc would be right way to fix this.

Since it's low priority bug and we don't want to half-fix the bug, we are going to move on for now, but if there is anyone who want and can take this up and want to fix it properly, we will help them get the fix into Ubuntu.

Steps to reproduce:

It is important to create dummy interfaces instead of bridges, because fix won't work.
It is also important to set them up and create more than 30.
Then simply type in 'nicstat' in command line.

Example of code to create bash script:

#!/bin/bash

for (( c=1; c<=40; c++ ))
do
        ip link add dummy$c type dummy
        ip link set dummy$c up
done

If you type in: cat /proc/net/dev you should be able to see the same number of interfaces as well. (and the same interfaces)

Changed in nicstat (Ubuntu):
assignee: Michał Małoszewski (michal-maloszewski99) → nobody
status: In Progress → Triaged
tags: removed: bitesize server-todo
Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

You can see network statistics which appear at the /proc/net/dev as well using either systat or netstat.

To configure systat:

$ sudo apt install sysstat
$ sudo service sysstat restart

Command to display data:
$ sar -n DEV 2 1

To configure netstat:

It should be configured in your system. (try netstat -v)

Command to display data:
$ netstat -ai

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.