Bug #3504
closedndnping prints meaningless stats on SIGQUIT if no packets were received
100%
Description
$ ndnping /foo
PING /foo
timeout from /foo: seq=8527235899119463658
timeout from /foo: seq=8527235899119463659
timeout from /foo: seq=8527235899119463660
^\0/3 packets, 100% loss, min/avg/max/mdev = 1.79769e+308/-nan/0/-nan ms
timeout from /foo: seq=8527235899119463661
timeout from /foo: seq=8527235899119463662
^C
--- /foo ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 0 ms
There are in fact two issues here. One is that Statistics::printSummary()
prints garbage when nReceived
is zero. It should simply skip the min/avg/max/mdev part in that case (operator<<
already has a similar check, and ping(8) does the same).
The second problem is that StatisticsCollector::computeStatistics()
divides by zero if m_nReceived
is zero. This is a floating point division by zero, so on most platforms the result will be infinity or NaN, but on others it can generate an exception and terminate the program. There should be a check against this, or we should do the division only if std::numeric_limits<double>::traps
is false.
Updated by Davide Pesavento over 9 years ago
- Assignee changed from Eric Newberry to Davide Pesavento
I can take this.
Updated by Davide Pesavento almost 9 years ago
- Assignee deleted (
Davide Pesavento)
It's clear that I haven't had time to work on this for several months, and the situation is unlikely to change in the near future.
Updated by Eric Newberry almost 9 years ago
I can take over work on this task if needed.
Updated by Junxiao Shi almost 9 years ago
- Assignee set to Eric Newberry
- Estimated time set to 1.50 h
Updated by Eric Newberry almost 9 years ago
- Status changed from New to In Progress
Updated by Eric Newberry almost 9 years ago
- Status changed from In Progress to Code review
- % Done changed from 0 to 100
The first issue appears to have already been resolved. I pushed a patch for the second issue.
Updated by Davide Pesavento almost 9 years ago
Why do you say that the first issue has been resolved?
Updated by Eric Newberry almost 9 years ago
Davide Pesavento wrote:
Why do you say that the first issue has been resolved?
I ran the latest version of ndnping and it didn't output the min/avg/max/mdev portion on 100% loss. However, upon looking further into the code, there is some duplication of the summary printing code between StatisticsCollector::printStatistics and operator<< for the Statistics struct. The ping client appears to use the latter, which does not print this portion when nReceived <= 0. This issue still exists in the former and is corrected in my patch.
Updated by Davide Pesavento almost 9 years ago
printSummary()
is used when the ndnping process receives a SIGQUIT.
Updated by Junxiao Shi almost 9 years ago
- Status changed from Code review to Closed