Worker crashed upon calling WebRtcTransport.close()

Hi, I am running mediasoup in a k8s container and the worker crashes when I attempt to close a webrtc transport. The crash only happens when I create a pipe transport on a router first, and then create & close a webrtc transport on the same router.

crash logs:

mediasoup:Transport close()
mediasoup:Channel request() [method:ROUTER_CLOSE_TRANSPORT]
mediasoup:ERROR:Worker (stderr) terminate called after throwing an instance of 'std::out_of_range' undefined
mediasoup:ERROR:Worker (stderr)   what():  vector<bool>::_M_range_check: __n (which is 18446744073709550847) >= this->size() (which is 201) undefined
mediasoup:Channel Consumer Channel ended by the worker process
mediasoup:ERROR:Channel Producer Channel error: Error: read ECONNRESET undefined
mediasoup:ERROR:Worker worker process died unexpectedly [pid:17, code:null, signal:SIGABRT] undefined
mediasoup:Worker died() [error:Error: [pid:17, code:null, signal:SIGABRT]]

my environment:
mediasoup version: 3.14.15
node version: v18.20.3
gcc/clang version: I used a pre-build mediasoup executable

steps to reproduce the crash:
1.create two mediasoup workers
2.create a router on each worker
3.create a pipe transport and call pipeTransport.connect() on each router
4.create a webrtc transport and call webrtcTransport.connect() on one of the routers
5.create producers on the transport, after 10-15 seconds, close the producers
6.call webrtcTransport.close(), triggering the crash

The worker works perfectly when I create a single router (and obviously not creating any pipe transports), but it consistently crashes when I create multiple routers across workers.
Audio & video transmission across routers is smooth and the mediasoup client apps can see and hear each other perfectly, the crash only happens when I try to free webrtc transports.

At first I thought I probably made a mistake when I create and free pipe producers/consumers, but it crashed even when no pipe producer/consumer were created.
Please help, thanks a lot!

Please open a bug report in mediasoup GitHub (don’t just paste a link to this thread, please) and include full information of your arch and OS, and if possible follow the steps to get and paste a core dump into the ticket as explained here:

More things to be included in the ticket in GitHub:

  • Is the crash reproducible without involving a real conecto in from a real browser?
  • Code snippet reproducing the problem.
  • Full logs when the issue happens (you need to enable both Node DEBUG environment variable and workerLogs.

Thanks.

Hi, ibc, sorry for the late reply.

I have made some further experimentation and found that the crash might be related to ip and portRange configuration.

I have created a github issue with some extra information, full mediasoup worker logs and code snippets that reproduces the crash attached.

Worker crash when webRtcTransport.close() is called #1466

I am sorry that I couldn’t attach the core dump now cause I had some trouble generating them in WSL. I’ll update the github issue once the core dump is available.