Bug #30
Updated by Vincenzo Cimino 5 months ago
Test script: `test_uwtdma.tcl` Protocol stack: ``` # +-------------------------+ # | 7. UW/CBR | # +-------------------------+ # | 6. UW/UDP | # +-------------------------+ # | 5. UW/STATICROUTING | # +-------------------------+ # | 4. UW/IP | # +-------------------------+ # | 3. UW/MLL | # +-------------------------+ # | 2. UW/TDMA | # +-------------------------+ # | 1. UW/PHYSICAL | # +-------------------------+ ``` If you Trying to send an async cross-layer message from the physical layer, i.e.: asyncClMsg to upper layer causes seg fault. Example: ```cpp ``` cpp UnderwaterPhysical::recv() { ... ClMsgUwPhyTxPwr ClMsgOverhearing *m = new ClMsgUwPhyTxPwr(); sendAsyncClMsg(m); ClMsgOverhearing(); m->setIPSource(iph->saddr()); ... sendAsyncClMsgUp(m); } ``` The script segfault, with Inside `sendAsyncClMsgUp(m)` (in module.cc) this backtrace: line executes ``` cpp #0 0x00007ffff7d27ee0 sap->sendUp(m->copy(), delay); ``` which in PlugIn::crLayCommand(ClMessage*) () from /home/cimino/Documents/DESERT_Underwater/DESERT_buildCopy_LOCAL/lib/libMiracle.so turn run this macro: (in sap.cc) No symbol table info available. ``` cpp No locals. RUN_DEPRECATED_OR_NEW_VIRTUAL_METHOD(upModule_->crLayCommand(m), upModule_->recvAsyncClMsg(m)); #2 0x00007ffff7d25233 in ClSAP::sendModule(ClMessage*, double) () from /home/cimino/Documents/DESERT_Underwater/DESERT_buildCopy_LOCAL/lib/libMiracle.so ``` which essentially will call the `crLayCommand(m)` method of plugIn class (plugin.cc) that does just this: No symbol table info available. ``` cpp #3 0x00007ffff7d3b65d in NodeCore::sendClSAP(int, int, ClMessage*) () from /home/cimino/Documents/DESERT_Underwater/DESERT_buildCopy_LOCAL/lib/libMiracle.so delete m; No symbol table info available. return RETVAL_NOT_IMPLEMENTED; #4 0x00007ffff7d3bb43 in NodeCore::crLayCommand(ClMessage*) () from /home/cimino/Documents/DESERT_Underwater/DESERT_buildCopy_LOCAL/lib/libMiracle.so ``` That is: deletes the cross layer message and return. No symbol table info available. Commenting the message deletion seems to solve the problem but it requires further investigating due to the presence of lots of deprecated methods. #5 0x00007ffff7d25558 in ClSAP::sendClLayer(ClMessage*, double) () from /home/cimino/Documents/DESERT_Underwater/DESERT_buildCopy_LOCAL/lib/libMiracle.so No symbol table info available. #6 0x00007ffff7d281fd in PlugIn::sendAsyncClMsg(ClMessage*, double) () from /home/cimino/Documents/DESERT_Underwater/DESERT_buildCopy_LOCAL/lib/libMiracle.so No symbol table info available. #7 0x00007ffff7936cde in UnderwaterPhysical::recv (this=0x555556146220, p=0x55555617b210) at /home/cimino/Documents/DESERT_Underwater/DESERT_Framework/DESERT/physical/uwphysical/uwphysical.cpp:281 m = 0x55555617c4e0 pe = 0x7ffff7c7ba01 <(anonymous namespace)::collate_c+17> ch = 0x55555617b338 ph = 0x55555617b2b8 __PRETTY_FUNCTION__ = "virtual void UnderwaterPhysical::recv(Packet*)" #8 0x00007ffff7d39acb in Module::recv(Packet*, int) () from /home/cimino/Documents/DESERT_Underwater/DESERT_buildCopy_LOCAL/lib/libMiracle.so No symbol table info available. ``` Anyways the message has to be deleted on the `recvAsyncClMsg` of the module receiving the message. Also when using `sendAsyncClMsgUp`, the message is never received by `recvAsyncClMsg` even though the receiving module is a layer above, while using `sendAsyncClMsg` works just fine.