Bug 390387 - network/sockets/tcp/list causes near freeze of KSysGuard measures refresh
Summary: network/sockets/tcp/list causes near freeze of KSysGuard measures refresh
Status: RESOLVED WORKSFORME
Alias: None
Product: ksysguard
Classification: Applications
Component: ksysguard (show other bugs)
Version: 5.12.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KSysGuard Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-13 17:50 UTC by Gerald Butler
Modified: 2022-12-15 05:15 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Example manually modified sgrd tab that includes the network/sockets/tcp/list measure/table (2.92 KB, application/x-ksysguard)
2018-02-13 17:50 UTC, Gerald Butler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gerald Butler 2018-02-13 17:50:18 UTC
Created attachment 110624 [details]
Example manually modified sgrd tab that includes the network/sockets/tcp/list measure/table

network/sockets/tcp/list is not available on the list of measures to be added to a tab unlike: network/sockets/udp/list, network/sockets/unix/list, network/sockets/raw/list. If you manually edit the Tab (.local/share/ksysguard/sheetXXX.sgrd) and manually add the network/sockets/tcp/list measure to a work-sheet, it works, but, all of the graphs (on all worksheets) slow to 30+ second refresh/update times. It seems like this particular measure has some issue (and that is why it isn't included in the list to select perhaps?).

The attached demonstrates the issue.
Comment 1 Gerald Butler 2018-02-13 17:57:06 UTC
Found this in the source:

if ((netstat = fopen("/proc/net/tcp", "r")) != NULL) {
0200         registerMonitor("network/sockets/tcp/count", "integer", printNetStat, printNetStatInfo, sm);
0201         /* This monitor takes _way_ too much time (up to a minute, or more) since it does DNS lookups
0202            Hide the monitor, leaving it there for backwards compatibility */
0203         registerLegacyMonitor("network/sockets/tcp/list", "listview", printNetStatTcpUdpRaw, printNetStatTcpUdpRawInfo, sm);
0204         fclose(netstat);
0205     }

This seems to indicate the issue is related to DNS look-ups. Any way to enable this without DNS look-ups (just so addresses)?
Comment 2 Gerald Butler 2018-02-13 18:07:40 UTC
Seems like this:


0129 char *get_host_name(int addr)
0130 {
0131     static char buffer[1024];
0132     struct hostent *host;
0133     struct in_addr a_addr;
0134 
0135     if (addr == 0) {
0136         return (char *)"*";
0137     }
0138 
0139     memset(buffer, 0, sizeof(buffer));
0140 
0141     if ((host = gethostbyaddr((char *)&addr, 4, AF_INET)) == NULL) {
0142         a_addr.s_addr = addr;
0143         return inet_ntoa(a_addr);
0144     } else {
0145         strncpy(buffer, host->h_name, sizeof(buffer)-1);
0146         buffer[sizeof(buffer) -1] = 0;
0147         return (char *)buffer;
0148     }
0149 }

Should be changed to have a timeout on "gethostbyaddr" of some small number of milliseconds (maybe like 10 ms)? Of course, that would involve an interruptable/time-outable get_host_by_addr wrapper of some sort. Ideally, this would simply put the physical address in the column and do the lookups async and populate the model with the host-names in the background if it was still wanted.
Comment 3 Justin Zobel 2022-11-15 22:58:47 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 4 Bug Janitor Service 2022-11-30 05:15:30 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Bug Janitor Service 2022-12-15 05:15:46 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!