Project

General

Profile

Actions

Bug #3503

closed

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

Added by Davide Pesavento over 8 years ago. Updated over 8 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.
Actions #1

Updated by Davide Pesavento over 8 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.

Actions #2

Updated by Junxiao Shi over 8 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.

Actions #3

Updated by Minsheng Zhang over 8 years ago

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

Actions #4

Updated by Minsheng Zhang over 8 years ago

  • % Done changed from 0 to 80
Actions #5

Updated by Minsheng Zhang over 8 years ago

  • Status changed from New to Code review
Actions #6

Updated by Junxiao Shi over 8 years ago

  • % Done changed from 80 to 100

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

Actions #7

Updated by Junxiao Shi over 8 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF