Project

General

Profile

Bug #3503

Assertion `nMaxEntries > 0' failed with cs_max_packets == 0

Added by Davide Pesavento over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Category:
Tables
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:

Description

We should print a nice error message instead of crashing.

[...]
1457018941.499514 INFO: [TablesConfigSection] Setting CS max packets to 0
nfd: ../daemon/table/cs-policy.cpp:44: void nfd::cs::Policy::setLimit(std::size_t): Assertion `nMaxEntries > 0' failed.
#1

Updated by Davide Pesavento over 4 years ago

In fact, why can't nMaxEntries (i.e. cs::Policy::m_limit) be zero? I don't see an obvious reason for this restriction, and it could be a useful setting for testing.

#2

Updated by Junxiao Shi over 4 years ago

  • Assignee set to Minsheng Zhang

cs::Policy::setLimit has no nMaxEntries > 0 declaration in Doxygen.

If this condition is in fact needed for all policies, it should be declared as part of \param, and the caller has the responsibility to ensure the argument is positive;
if this condition is only needed for some policies, it should be mentioned in a \throw, and the callee should use an exception rather than an assertion to check the condition, and the caller may catch the exception and produce an error message.

It's wrong for cs::Policy::setLimit to print an error message and retain the previous setting, because this would admit an incorrect configuration file.


I'm assigning this to @MinSheng who authored cs-policy.hpp.

#3

Updated by Minsheng Zhang over 4 years ago

@David and @Junxiao, I agree that nMaxEntries would be zero and will change codes if there is no exception.

#4

Updated by Minsheng Zhang over 4 years ago

  • % Done changed from 0 to 80
#5

Updated by Minsheng Zhang over 4 years ago

  • Status changed from New to Code review
#6

Updated by Junxiao Shi over 4 years ago

  • % Done changed from 80 to 100

I uploaded http://gerrit.named-data.net/2753 patchset7 that improves the test case.

#7

Updated by Junxiao Shi over 4 years ago

  • Status changed from Code review to Closed

Also available in: Atom PDF