Bug #3504
closed
ndnping prints meaningless stats on SIGQUIT if no packets were received
Added by Davide Pesavento over 9 years ago.
Updated almost 9 years ago.
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.
- Assignee set to Eric Newberry
- Assignee changed from Eric Newberry to Davide Pesavento
- 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.
I can take over work on this task if needed.
- Assignee set to Eric Newberry
- Estimated time set to 1.50 h
- Status changed from New to In Progress
- 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.
Why do you say that the first issue has been resolved?
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.
printSummary() is used when the ndnping process receives a SIGQUIT.
- Status changed from Code review to Closed
Also available in: Atom
PDF