[ndnSIM] How to obtain the overflowed Data on routers

Miho AOKI q304001zu at gmail.com
Wed Sep 7 03:59:49 PDT 2016


Hi, Junxiao
Thank you for the reply.

We changed the question.
Would you please help us again?


   1. When a Data acquisition request has occurred at a Consumer,
   corresponding Interest will be forwarded toward a destined Producer.
   2. The router having cached Data for the Interest, sends back the Data
   to the Consumer.
   3. The Data will be cached at the inter mediate routers belonging to the
   return path to the Consumer.
   4. At this time, if the number of cached Data exceeds the upper limit of
   the CS (default:100), one Data selected according to CS policy is evicted
   at the  default ndnSIM.(Currently, we adopt LRU policy.)
   5. So, we’d like to transfer the selected Data for eviction, to the
   other neighbor routers, and keep it at the CS.
   6. For the above objective, we modified the operation of ndnSIM as
   follows :
      - At the router receiving a Interest,
   1. Copy all cached Data (CS entry) to local memory as (line:50-52)
            - std::vector<std::string> beforeCS;
            - for(int i = 0; i < cssize; i++) {
            beforeCS.push_back(getCs().getEntryName(i).toUri()); }
         2. Call “ m_cs.insert(*dataCopyWithout Packet) “
         3. Copy all cached Data to local memory as (line:65-67)
            - std::vector<std::string> afterCS;
            - for(int i = 0; i < cssize; i++){
            afterCS.push_back(getCs().getEntryName(i).toUri()); }
         4. Identify the evicted cached Data by comparing afterCS and
         beforeCS, and, obtain the Data from the beforeCS.
      7. In the above process, we could identify the evicted cached Data.
      1. We’re trying to send the evicted Data to neighbor router by using
      “onOutgoingData (forwarder.cpp)”. (line:110) As the following log
      indicated, the transmission seems to success at the sender side.
         - Extract of the log
            - 10.4775s 1 nfd.Forwarder:onOutgoingData(): [DEBUG]
            onOutgoingData face=259 data=/prefix/%FE%00
            - 10.4775s 1 ndn.NetDeviceFace:sendData(0x7f848a6029d8,
            0x10c033000)
         2. However, the following log is also output and simulation stops.
         - libc++abi.dylib: terminating with uncaught exception of type
         std::__1::bad_weak_ptr: bad_weak_ptr
         8. Would you give us the advice how to realize the operation we
   wanted?



————————————————————————————————————

   1. void
   2. Forwarder::onIncomingData(Face& inFace, const Data& data)
   3. {
   4.     // receive Data
   5.     NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() << "
   data=" << data.getName());
   6.     const_cast<Data&>(data).setIncomingFaceId(inFace.getId());
   7.     ++m_counters.getNInDatas();
   8.
   9.     // /localhost scope control
   10.     bool isViolatingLocalhost = !inFace.isLocal() &&
   11.     LOCALHOST_NAME.isPrefixOf(data.getName());
   12.     if (isViolatingLocalhost) {
   13.         NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() <<
   14.                       " data=" << data.getName() << " violates
   /localhost");
   15.         // (drop)
   16.         return;
   17.     }
   18.
   19.     // PIT match
   20.     pit::DataMatchResult pitMatches = m_pit.findAllDataMatches(data);
   21.     if (pitMatches.begin() == pitMatches.end()) {
   22.         // goto Data unsolicited pipeline
   23.         this->onDataUnsolicited(inFace, data);
   24.         return;
   25.     }
   26.
   27.     // Remove Ptr<Packet> from the Data before inserting into cache,
   serving two purposes
   28.     // - reduce amount of memory used by cached entries
   29.     // - remove all tags that (e.g., hop count tag) that could have
   been associated with Ptr<Packet>
   30.     //
   31.     // Copying of Data is relatively cheap operation, as it copies
   (mostly) a collection of Blocks
   32.     // pointing to the same underlying memory buffer.
   33.     shared_ptr<Data> dataCopyWithoutPacket = make_shared<Data>(data);
   34.     dataCopyWithoutPacket->removeTag<ns3::ndn::Ns3PacketTag>();
   35.
   36.     // before CS entry 7/27
   37.     std::vector<std::string> beforeCS;
   38.     // after CS entry 7/28
   39.     std::vector<std::string> afterCS;
   40.
   41.     int cssize;
   42.     cssize = getCs().size();
   43.     // Data 7/28
   44.     std::vector<Data> data1;
   45.
   46.     // CS insert
   47.     if (m_csFromNdnSim == nullptr){
   48.
   49.         // insert CS entry in beforeCS 7/29
   50.         for(int i = 0; i < cssize; i++){
   51.             beforeCS.push_back(getCs().getEntryName(i).toUri());
   52.         }
   53.         // insert Data in data1 7/29
   54.         for(const cs::EntryImpl& entry : getCs().m_table){
   55.             data1.push_back(entry.getData());
   56.         }
   57.
   58.         m_cs.insert(*dataCopyWithoutPacket);
   59.
   60.     }
   61.     else
   62.         m_csFromNdnSim->Add(dataCopyWithoutPacket);
   63.
   64.     // insert CS entry in afterCS 7/29
   65.     for(int j = 0; j < cssize; j++){
   66.         afterCS.push_back(getCs().getEntryName(j).toUri());
   67.     }
   68.
   69.     int dsize;
   70.     dsize = data1.size();
   71.
   72.     if(ns3::Simulator::GetContext() == 1){
   73.         std::string beCS;
   74.         std::string DATA;
   75.         shared_ptr<Face> OUTFACE;
   76.
   77.         int n = 0;
   78.
   79.         int csize;
   80.         csize = getCs().size();
   81.         // comparison of beforeCS and afterCS
   82.         int k = 0;
   83.         for(; k < csize; ++k){
   84.             int l = 0;
   85.             for(; l < csize; ++l){
   86.                 if(beforeCS[k] == afterCS[l]) break;
   87.             }
   88.             if(l < csize){
   89.                 break;
   90.             }
   91.             else{
   92.                 beCS = beforeCS[k];
   93.                 for(int m = 0; m < dsize; m++){
   94.                     DATA = data1[m].getName().toUri();
   95.                     if( beCS == DATA ){
   96.                         n = m;
   97.                         for(auto itr = mfaces.begin(); itr !=
   mfaces.end(); ++itr){
   98.                             if((int)(inFace.getId()) > 255){
   99.
   if(itr->second->getRemoteUri().toString() ==
   itr->second->getLocalUri().toString() &&
   itr->second->getLocalUri().toString() == "netDeviceFace://"){
   100.                                     if(itr->second->getId() !=
   inFace.getId()){
   101.                                         if(itr->second->getId() ==
   259){
   102.                                             OUTFACE = itr->second;
   103.                                         }
   104.                                     } // end
   if(itr->second->getId() != inFace.getId())
   105.                                 } // end
   if(itr->second->getRemoteUri().toString()...)
   106.                             } // end if((int)(inFace.getId()) > 255)
   107.                         } // end if (auto itr...)
   108.                     } // end if( beCS == DATA )
   109.                 } //end for(int m = 0; m < dsize; m++)
   110.             } // end else
   111.             this->onOutgoingData(data1[n], *OUTFACE);
   112.         } // end for(; k < csize; ++k)
   113.     } // endif(ns3::Simulator::GetContext() == 1)
   114.
   115.
   116.     std::set<shared_ptr<Face> > pendingDownstreams;
   117.     // foreach PitEntry
   118.     for (const shared_ptr<pit::Entry>& pitEntry : pitMatches) {
   119.         NFD_LOG_DEBUG("onIncomingData matching=" <<
   pitEntry->getName());
   120.
   121.         // cancel unsatisfy & straggler timer
   122.         this->cancelUnsatisfyAndStragglerTimer(pitEntry);
   123.
   124.             // remember pending downstreams
   125.             const pit::InRecordCollection& inRecords =
   pitEntry->getInRecords();
   126.             for (pit::InRecordCollection::const_iterator it =
   inRecords.begin();
   127.                 it != inRecords.end(); ++it) {
   128.                 if (it->getExpiry() > time::steady_clock::now()) {
   129.                     pendingDownstreams.insert(it->getFace());
   130.                     faceid[fcnt++] = (it->getFace())->getId();
   131.                 }
   132.             }
   133.
   134.         // invoke PIT satisfy callback
   135.         beforeSatisfyInterest(*pitEntry, inFace, data);
   136.         this->dispatchToStrategy(pitEntry,
   bind(&Strategy::beforeSatisfyInterest, _1,
   137.                                                 pitEntry,
   cref(inFace), cref(data)));
   138.
   139.         // Dead Nonce List insert if necessary (for OutRecord of
   inFace)
   140.         this->insertDeadNonceList(*pitEntry, true,
   data.getFreshnessPeriod(), &inFace);
   141.
   142.         // mark PIT satisfied
   143.         pitEntry->deleteInRecords();
   144.         pitEntry->deleteOutRecord(inFace);
   145.
   146.         // set PIT straggler timer
   147.         this->setStragglerTimer(pitEntry, true,
   data.getFreshnessPeriod());
   148.     }
   149.
   150.     // foreach pending downstream
   151.     for (std::set<shared_ptr<Face> >::iterator it =
   pendingDownstreams.begin();
   152.         it != pendingDownstreams.end(); ++it) {
   153.         shared_ptr<Face> pendingDownstream = *it;
   154.         if (pendingDownstream.get() == &inFace) {
   155.             continue;
   156.         }
   157.         // goto outgoing Data pipeline
   158.         this->onOutgoingData(data, *pendingDownstream);
   159.     }
   160. }

————————————————————————————————————


Best regards,

Miho Aoki

2016-09-05 22:06 GMT+09:00 Junxiao Shi <shijunxiao at email.arizona.edu>:

> Hi Miho
>
>
>
> I neither understand nor agree with what you are trying to do. There’s no
> concept of "overflowed Data” in NFD.
>
>
>
> The exception indicates an object not managed by a shared_ptr is passed to
> a function that calls shared_from_this on that object. You may use GDB or
> LLDB to obtain a backtrace where this exception is thrown, and investigate
> the mistake from there.
>
>
>
> Yours, Junxiao
>
>
>
> *From: *Miho AOKI <q304001zu at gmail.com>
> *Sent: *Sunday, September 4, 2016 23:25
> *To: *ndnsim at lists.cs.ucla.edu
> *Subject: *[ndnSIM] How to obtain the overflowed Data on routers
>
>
>
> Hi,
>
>
>
> We would like to transmit the overflowed Data (in any buffer) to
> neighboring routers.
>
>
>
> Currently, we're trying to make the above operation using " onOutgoingData
> (forwarder.cpp) ", however, the following log is output and cannot transfer
> the overflowed Data.
>
>
>
> libc++abi.dylib: terminating with uncaught exception of type
> std::__1::bad_weak_ptr: bad_weak_ptr
>
>
>
>
>
> How should we obtain the overflowed Data?
>
>
>
> Would you please help us?
>
>
>
> Best regards,
>
> Miho Aoki
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20160907/4fbd88a2/attachment.html>


More information about the ndnSIM mailing list