Bug #3503
closedAssertion `nMaxEntries > 0' failed with cs_max_packets == 0
100%
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.
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.
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
.
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.
Updated by Minsheng Zhang over 8 years ago
- Status changed from New to Code review
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.
Updated by Junxiao Shi over 8 years ago
- Status changed from Code review to Closed