Samraksh / eMote

eMote OS -- Multiple Ports (using .NET MF v4.3)
0 stars 0 forks source link

OMAC dropped messages & neighbor disconnect #414

Open WilliamAtSamraksh opened 8 years ago

WilliamAtSamraksh commented 8 years ago

Software ID: 571e77b411a5a7aaa02f47e0b173e11c01ca1fc5, eMote v. 16 A (or whatever our incremental numbering system is) ... To reproduce, use System > Virtual Fence > Base Node & Fence Node from the attachment.

2016.05.31 Managed Virtual Fence.zip

In the two logs below, the Base Node receives messages # 1, 2, 4 & 7 while the Fence Node sends # 1-17, so messages 3, 5-6 and 8-17 are lost. Note in the Fence Node log that between messages # 8 and 9, the Base Node is dropped from the neighbor list. The rate at which messages are sent is about one per 20 seconds.

Base Node Log

Version 1.5, build 05/31/2016 11:21:46
Getting MAC
##################################################
MAC is OMAC
Self address: 30907
##################################################
Initializing Base Station
###1
Neighbor List 0 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 4): 65 108 105 118 101 48 124 48 
        Sent routing beacon# 0: Alive0|0
###2
***** Subscribing to Routing on 4

Initializing Base Node Routing...
*** Self address: 30907
***** Subscribing to App on 1

*** Initializing NetManager ***

***** subscribing to Net Manager on 3
******************* App receive
    on 1
App Rcv: 72 117 109 97 110 32 48 95 77 115 103 35 49 
Received App message: Human 0_Msg#1; source:  0_Msg#1; from Node: 27786

    Received decision: Human; source:  0_Msg#1; from Node: 27786
    At base
******************* App receive
    on 1
App Rcv: 72 117 109 97 110 32 48 95 77 115 103 35 50 
Received App message: Human 0_Msg#2; source:  0_Msg#2; from Node: 27786

    Received decision: Human; source:  0_Msg#2; from Node: 27786
    At base
******************* App receive
    on 1
App Rcv: 72 117 109 97 110 32 48 95 77 115 103 35 52 
Received App message: Human 0_Msg#4; source:  0_Msg#4; from Node: 27786

    Received decision: Human; source:  0_Msg#4; from Node: 27786
    At base
******************* App receive
    on 1
App Rcv: 72 117 109 97 110 32 48 95 77 115 103 35 55 
Received App message: Human 0_Msg#7; source:  0_Msg#7; from Node: 27786

    Received decision: Human; source:  0_Msg#7; from Node: 27786
    At base
OMACTimeSync::Receive. Sending t

Fence Node Log

setting m 1 of n 0

Virtual Fence with Health Manager: Fence Node:  Version 1.5, build 05/31/2016 11:04:20
Getting MAC
##################################################
MAC is OMAC
Self address: 27786
##################################################
***** subscribing to Local Manager on 2
Neighbor List 0 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 2): 78 111 119 32 83 116 97 114 116 105 110 103 
SetAppHandlers 3
prime 1: 163    prime 2: 769
discoInterval: 125347
SharedMembers length: 0
Initializing relay node
###1
Neighbor List 0 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 4): 65 108 105 118 101 48 124 48 
        Sent routing beacon# 0: Alive0|0
###2
***** Subscribing to Routing on 4

Initializing Fence Node Routing...
***** Subscribing to App on 1

*** Initializing NetManager ***

***** subscribing to Net Manager on 3
Neighbor List 0 0 0 0 0 0 0 0 0 0 0 0 
Starting ADC
Uninit M, N
setting m 6 of n 2
*** Displacement
$$$$$Human detected 1$$$$$
Neighbor List 30907 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 49 
    Sent to 30907
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 49 
*** Broadcast data# 0: <Human 0_Msg#1>
*** Displacement
$$$$$Human detected 2$$$$$
Neighbor List 30907 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 50 
    Sent to 30907
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 50 
*** Broadcast data# 1: <Human 0_Msg#2>
*** Displacement
$$$$$Human detected 3$$$$$
Neighbor List 30907 0 0 0 0 0 0 0 0 0 0 0 
OMACType::Send neighborEntry->send_buffer full.
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 51 
    Sent to 30907
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 51 
*** Broadcast data# 2: <Human 0_Msg#3>
*** Displacement
$$$$$Human detected 4$$$$$
Neighbor List 30907 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 52 
    Sent to 30907
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 52 
*** Broadcast data# 3: <Human 0_Msg#4>
*** Displacement
$$$$$Human detected 5$$$$$
Neighbor List 30907 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 53 
    Sent to 30907
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 53 
*** Broadcast data# 4: <Human 0_Msg#5>
OMACType::Send neighborEntry->send_buffer full.
*** Displacement
$$$$$Human detected 6$$$$$
Neighbor List 30907 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 54 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Send status: 5
    Sent to 30907
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 54 
*** Broadcast data# 5: <Human 0_Msg#6>
OMACType::Send neighborEntry->send_buffer full.
*** Displacement
$$$$$Human detected 7$$$$$
Neighbor List 30907 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 55 
    Sent to 30907
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 55 
*** Broadcast data# 6: <Human 0_Msg#7>
*** Displacement
$$$$$Human detected 8$$$$$
Neighbor List 30907 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 56 
    Sent to 30907
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 56 
*** Broadcast data# 7: <Human 0_Msg#8>
OMACType::Send neighborEntry->send_buffer full.
*** Displacement
$$$$$Human detected 9$$$$$
Neighbor List 30907 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 57 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Send status: 5
    Sent to 30907
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 57 
*** Broadcast data# 8: <Human 0_Msg#9>
OMACType::Send neighborEntry->send_buffer full.
[NATIVE] Neighbors.h : Removing Neighbor due to inactivity
Old neighbor list: 0 0 0 0 0 0 0 0 0 0 0 0 
New neighbor list: 0 0 0 0 0 0 0 0 0 0 0 0 
*** Displacement
$$$$$Human detected 10$$$$$
Neighbor List 0 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 49 48 
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 49 48 
*** Broadcast data# 9: <Human 0_Msg#10>
*** Displacement
$$$$$Human detected 11$$$$$
Neighbor List 0 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 49 49 
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 49 49 
*** Broadcast data# 10: <Human 0_Msg#11>
*** Displacement
$$$$$Human detected 12$$$$$
Neighbor List 0 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 49 50 
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 49 50 
*** Broadcast data# 11: <Human 0_Msg#12>
*** Displacement
$$$$$Human detected 13$$$$$
Neighbor List 0 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 49 51 
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 49 51 
*** Broadcast data# 12: <Human 0_Msg#13>
DataTransmissionHandler::ScheduleDataPacket() neighbor time is not known!!!
*** Displacement
$$$$$Human detected 14$$$$$
Neighbor List 30907 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 49 52 
    Sent to 30907
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 49 52 
*** Broadcast data# 13: <Human 0_Msg#14>
*** Displacement
$$$$$Human detected 15$$$$$
Neighbor List 30907 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 49 53 
    Sent to 30907
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 49 53 
*** Broadcast data# 14: <Human 0_Msg#15>
OMACType::Send neighborEntry->send_buffer full.
*** Displacement
$$$$$Human detected 16$$$$$
Neighbor List 30907 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 49 54 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Send status: 5
    Sent to 30907
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 49 54 
*** Broadcast data# 15: <Human 0_Msg#16>
OMACType::Send neighborEntry->send_buffer full.
*** Displacement
$$$$$Human detected 17$$$$$
Neighbor List 30907 0 0 0 0 0 0 0 0 0 0 0 
SendToAllNeighbors (on MACPipe 1): 72 117 109 97 110 32 48 95 77 115 103 35 49 55 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Send status: 5
    Sent to 30907
App Snd: 72 117 109 97 110 32 48 95 77 115 103 35 49 55 
*** Broadcast data# 16: <Human 0_Msg#17>
OMACType::Send neighborEntry->send_buffer full.
WilliamAtSamraksh commented 8 years ago

Putting in a 30 second delay after instantiating OMAC and before sending seems to work. In the program, Send only occurs when the neighbor list shows a neighbor, but apparently that is before OMAC stabilizes and there's some interference.

If OMAC has to stabilize before sending then an attempt to send before that happens should throw an exception; and the user should be provided with a semaphore (ManualResetEvent in C#) such as MACReady that can be used to wait until OMAC is ready.

For consistency, MACReady should be in IMAC so that CSMA will have it as well (although in this case the stabilization time is zero). In any case, the user would be encouraged to use a wait on MACReady.as a part of normal programming.