srt icon indicating copy to clipboard operation
srt copied to clipboard

[BUG] Deadlock at cleanup due to pending delivery.

Open STVHA opened this issue 2 years ago • 1 comments

I am using SRT 5.3.1 for data transmission from one PC to another. I setup for both sender and receiver like this:

  • Transtype=SRTT_FILE,
  • MessageAPI=true,
  • BlockingMode = false,
  • Latency = 100

It seems working well within one PC, but for cross-PC, sometimes the sender stops sending in the middle of transmission When I close the sender, it hangs forever.

Here are the stack of all SRT's related threads when the hang happened. I hope those may be helpful for your debug.

// MainThread:
 	srt.dll!std::thread::join() Line 133	C++
	srt.dll!srt::CUDTUnited::cleanup() Line 306	C++
 	srt.dll!srt::CUDT::cleanup() Line 3363	C++
 	srt.dll!srt_cleanup() Line 33	C++

This is the context of the CUDTUnited:

CUDTUnited-context

// GarbageCollect:
	srt.dll!std::thread::join() Line 133	C++
	srt.dll!srt::CSndQueue::~CSndQueue() Line 434	C++
 	srt.dll!srt::CSndQueue::`scalar deleting destructor'(unsigned int)	C++
 	srt.dll!srt::CMultiplexer::destroy() Line 1791	C++
 	srt.dll!srt::CUDTUnited::removeSocket(const int u) Line 2822	C++
 	srt.dll!srt::CUDTUnited::checkBrokenSockets() Line 2702	C++
 	srt.dll!srt::CUDTUnited::garbageCollect(void * p) Line 3338	C++

This is the context of the CSndQueue:

CSndQueue-context

// SendingWorker:
	ws2_32.dll!00007ffc249a2c10()	Unknown
	srt.dll!srt::CChannel::sendto(const srt::sockaddr_any & addr, srt::CPacket & packet, const srt::sockaddr_any & source_addr) Line 784	C++
 	srt.dll!srt::CSndQueue::worker(void * param) Line 597	C++
 	srt.dll!std::invoke<void * (__cdecl*)(void *),void *>(void *(*)(void *) && _Obj, void * && _Arg1) Line 1756	C++
 	srt.dll!std::thread::_Invoke<std::tuple<void * (__cdecl*)(void *),void *>,0,1>(void * _RawVals) Line 61	C++

This is the context of the CChannel:

CChannel-context

Local variables inside CChannel::sendto() CChannel-sendto() local vars

STVHA avatar Jan 04 '24 03:01 STVHA

Likely related to the issue in SRT v1.5.3 fixed in PR #2834.

maxsharabayko avatar Jan 08 '24 09:01 maxsharabayko

Closing: no activity and likely solved by #2834.

maxsharabayko avatar Aug 23 '24 08:08 maxsharabayko