fw: Minor bug fixes for timeout sensitivity and ignored probes in ASF
refs #4983, #4193
Change-Id: I2cf9ac9b51be83e8b03dca40221c7e550c4878a1
diff --git a/daemon/fw/asf-strategy.cpp b/daemon/fw/asf-strategy.cpp
index 90b4ebe..b9a253d 100644
--- a/daemon/fw/asf-strategy.cpp
+++ b/daemon/fw/asf-strategy.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2020, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -58,7 +58,7 @@
this->setInstanceName(makeInstanceName(name, getStrategyName()));
NFD_LOG_DEBUG("probing-interval=" << m_probing.getProbingInterval()
- << " n-silent-timeouts=" << m_maxSilentTimeouts);
+ << " n-silent-timeouts=" << m_nMaxSilentTimeouts);
}
const Name&
@@ -98,7 +98,7 @@
m_probing.setProbingInterval(getParamValue(f, s));
}
else if (f == "n-silent-timeouts") {
- m_maxSilentTimeouts = getParamValue(f, s);
+ m_nMaxSilentTimeouts = getParamValue(f, s);
}
else {
NDN_THROW(std::invalid_argument("Parameter should be probing-interval or n-silent-timeouts"));
@@ -193,7 +193,8 @@
// Extend lifetime for measurements associated with Face
namespaceInfo->extendFaceInfoLifetime(*faceInfo, ingress.face.getId());
-
+ // Extend PIT entry timer to allow slower probes to arrive
+ this->setExpiryTimer(pitEntry, 50_ms);
faceInfo->cancelTimeout(data.getName());
}
@@ -202,7 +203,7 @@
const shared_ptr<pit::Entry>& pitEntry)
{
NFD_LOG_DEBUG(nack.getInterest() << " nack from=" << ingress << " reason=" << nack.getReason());
- onTimeout(pitEntry->getName(), ingress.face.getId());
+ onTimeoutOrNack(pitEntry->getName(), ingress.face.getId(), true);
}
void
@@ -230,7 +231,7 @@
if (!faceInfo.isTimeoutScheduled()) {
auto timeout = faceInfo.scheduleTimeout(interest.getName(),
[this, name = interest.getName(), faceId = egress.face.getId()] {
- onTimeout(name, faceId);
+ onTimeoutOrNack(name, faceId, false);
});
NFD_LOG_TRACE("Scheduled timeout for " << fibEntry.getPrefix() << " to=" << egress
<< " in " << time::duration_cast<time::milliseconds>(timeout) << " ms");
@@ -318,7 +319,7 @@
}
void
-AsfStrategy::onTimeout(const Name& interestName, FaceId faceId)
+AsfStrategy::onTimeoutOrNack(const Name& interestName, FaceId faceId, bool isNack)
{
NamespaceInfo* namespaceInfo = m_measurements.getNamespaceInfo(interestName);
if (namespaceInfo == nullptr) {
@@ -336,7 +337,7 @@
size_t nTimeouts = faceInfo.getNSilentTimeouts() + 1;
faceInfo.setNSilentTimeouts(nTimeouts);
- if (nTimeouts <= m_maxSilentTimeouts) {
+ if (nTimeouts <= m_nMaxSilentTimeouts && !isNack) {
NFD_LOG_TRACE(interestName << " face=" << faceId << " timeout-count=" << nTimeouts << " ignoring");
// Extend lifetime for measurements associated with Face
namespaceInfo->extendFaceInfoLifetime(faceInfo, faceId);
diff --git a/daemon/fw/asf-strategy.hpp b/daemon/fw/asf-strategy.hpp
index cba941e..e0d40c7 100644
--- a/daemon/fw/asf-strategy.hpp
+++ b/daemon/fw/asf-strategy.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2020, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -83,7 +83,7 @@
bool isNewInterest = true);
void
- onTimeout(const Name& interestName, FaceId faceId);
+ onTimeoutOrNack(const Name& interestName, FaceId faceId, bool isNack);
void
sendNoRouteNack(const FaceEndpoint& ingress, const shared_ptr<pit::Entry>& pitEntry);
@@ -92,7 +92,7 @@
AsfMeasurements m_measurements;
ProbingModule m_probing;
RetxSuppressionExponential m_retxSuppression;
- size_t m_maxSilentTimeouts = 0;
+ size_t m_nMaxSilentTimeouts = 3;
static const time::milliseconds RETX_SUPPRESSION_INITIAL;
static const time::milliseconds RETX_SUPPRESSION_MAX;
diff --git a/tests/daemon/fw/asf-strategy.t.cpp b/tests/daemon/fw/asf-strategy.t.cpp
index 14aa777..90e8524 100644
--- a/tests/daemon/fw/asf-strategy.t.cpp
+++ b/tests/daemon/fw/asf-strategy.t.cpp
@@ -143,7 +143,8 @@
// and the probe should return Data quicker. ASF should then use the Face
// to nodeB to forward the remaining Interests.
BOOST_CHECK_EQUAL(consumer->getForwarderFace().getCounters().nOutData, 30);
- BOOST_CHECK_GE(linkAB->getFace(nodeA).getCounters().nOutInterests, 24);
+ // Because of exploration, will forward to AB and AD simultaneously at least once
+ BOOST_CHECK_GE(linkAB->getFace(nodeA).getCounters().nOutInterests, 25);
BOOST_CHECK_LE(linkAD->getFace(nodeA).getCounters().nOutInterests, 6);
// If the link from nodeA to nodeB fails, ASF should start using the Face
@@ -151,11 +152,10 @@
linkAB->fail();
runConsumer();
-
- // Only 59 Data because the first Interest to nodeB after the failure should timeout
- BOOST_CHECK_EQUAL(consumer->getForwarderFace().getCounters().nOutData, 59);
- BOOST_CHECK_LE(linkAB->getFace(nodeA).getCounters().nOutInterests, 30);
- BOOST_CHECK_GE(linkAD->getFace(nodeA).getCounters().nOutInterests, 30);
+ // We experience 3 silent timeouts before marking AB as timed out on the fourth interest.
+ BOOST_CHECK_EQUAL(consumer->getForwarderFace().getCounters().nOutData, 56);
+ BOOST_CHECK_LE(linkAB->getFace(nodeA).getCounters().nOutInterests, 36);
+ BOOST_CHECK_GE(linkAD->getFace(nodeA).getCounters().nOutInterests, 24);
// If the link from nodeA to nodeB recovers, ASF should probe the Face
// to nodeB and start using it again.
@@ -165,8 +165,7 @@
this->advanceClocks(10_ms, 10_s);
runConsumer();
-
- BOOST_CHECK_EQUAL(consumer->getForwarderFace().getCounters().nOutData, 89);
+ BOOST_CHECK_EQUAL(consumer->getForwarderFace().getCounters().nOutData, 86);
BOOST_CHECK_GE(linkAB->getFace(nodeA).getCounters().nOutInterests, 50);
BOOST_CHECK_LE(linkAD->getFace(nodeA).getCounters().nOutInterests, 40);
@@ -176,9 +175,9 @@
runConsumer();
- BOOST_CHECK_EQUAL(consumer->getForwarderFace().getCounters().nOutData, 89);
- BOOST_CHECK_LE(linkAB->getFace(nodeA).getCounters().nOutInterests, 61); // FIXME #3830
- BOOST_CHECK_GE(linkAD->getFace(nodeA).getCounters().nOutInterests, 59); // FIXME #3830
+ BOOST_CHECK_EQUAL(consumer->getForwarderFace().getCounters().nOutData, 86);
+ BOOST_CHECK_LE(linkAB->getFace(nodeA).getCounters().nOutInterests, 65); // FIXME #3830
+ BOOST_CHECK_GE(linkAD->getFace(nodeA).getCounters().nOutInterests, 57); // FIXME #3830
}
BOOST_FIXTURE_TEST_CASE(Nack, AsfGridFixture)