USNavalResearchLaboratory / norm

NACK-Oriented Reliable Multicast (NORM) implementation & tools (RFCs 5740, 5401)

Home Page:https://www.nrl.navy.mil/Our-Work/Areas-of-Research/Information-Technology/NCS/NORM/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segmentation fault (normObject.cpp)

fattaholmanan opened this issue · comments

I have made a small modification in the normDataSend.cpp example to continuously send new messages with random length. I did it simply, by adding a goto statement in the switch-case: NORM_TX_FLUSH_COMPLETED to repeat the whole process.

It seems working properly, however, after sending roughly around 50 messages, it throws a segmentation fault. Below is the stack, when the exception happens:

(gdb) where
#0  __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:378
#1  0x00005555555df58d in NormDataObject::ReadSegment (this=0x555555a2e710, blockId=..., segmentId=0, buffer=0x555555948050 'a' <repeats 200 times>...) at ../src/common/normObject.cpp:2708
#2  0x00005555555dcdbb in NormObject::NextSenderMsg (this=0x555555a2e710, msg=0x555555948030) at ../src/common/normObject.cpp:1999
#3  0x00005555555eff00 in NormSession::Serve (this=0x555555916fa0) at ../src/common/normSession.cpp:1312
#4  0x00005555555fb985 in NormSession::OnTxTimeout (this=0x555555916fa0) at ../src/common/normSession.cpp:4848
#5  0x0000555555601fe8 in ProtoTimer::OLD_LISTENER_TYPE<NormSession>::old_on_timeout (this=0x555555915460, theTimer=...) at ../protolib/include/protoTimer.h:292
#6  0x000055555559d734 in ProtoTimer::OldListener::on_timeout (this=0x555555915460, theTimer=...) at ../protolib/include/protoTimer.h:266
#7  0x000055555559d667 in ProtoTimer::DoTimeout (this=0x555555916fb0) at ../protolib/include/protoTimer.h:206
#8  0x000055555559c428 in ProtoTimerMgr::OnSystemTimeout (this=0x555555914998) at ../protolib/src/common/protoTimer.cpp:180
#9  0x00005555555723d5 in ProtoDispatcher::Dispatch (this=0x555555914998) at ../protolib/src/common/protoDispatcher.cpp:1943
#10 0x00005555555708bc in ProtoDispatcher::Run (this=0x555555914998, oneShot=false) at ../protolib/src/common/protoDispatcher.cpp:989
#11 0x0000555555570aad in ProtoDispatcher::DoThreadStart (param=0x555555914998) at ../protolib/src/common/protoDispatcher.cpp:1060
#12 0x00007ffff7bbb6db in start_thread (arg=0x7ffff6e83700) at pthread_create.c:463
#13 0x00007ffff6fa561f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

I found this line later that was the source to the issue:

char* dataPtr = NormDataDetachData(theEvent.object);
delete[] dataPtr;