Opened 11 months ago

Closed 11 months ago

Last modified 7 months ago

#2160 closed defect (fixed)

Fix stuck issue in ioqueue when detaching UDP media transport

Reported by: ming Owned by: nanang
Priority: normal Milestone: release-2.9
Component: pjmedia Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description

The issue is caused by two things:

  • Due to #2097, pjmedia_transport_media_stop() for UDP transport will call pj_ioqueue_post_completion(). This will trigger on_read_complete() callback, i.e. on_rx_rtp() which will call pj_ioqueue_recvfrom(). So the read operations never really stop.
  • Ioqueue itself never checks when an op_key is already in the list. Thus, when the media transport is restarted, it will call pj_ioqueue_recvfrom() again. Calling recv() with the same op_key will cause the list to be in a bad state (i.e. the element's next and prev pointers will lose track of its neighbours, hence causing the list to be uniterable). Thus, when later calling pjmedia_transport_detach(), and UDP media transport calling pj_ioqueue_post_completion() for its pending write_op, the function may get stuck when iterating the read list.

Change History (2)

comment:1 Changed 11 months ago by ming

  • Resolution set to fixed
  • Status changed from new to closed

In 5907:

Fixed #2160: stuck issue in ioqueue when detaching UDP media transport

  • Fixed transport_udp so it won't call another read operation when being stopped.
  • Add robustness checks (assertion) in ioqueue recv, recvfrom, and accept to prevent the same op key being used twice.

comment:2 Changed 7 months ago by ming

In 5953:

Re #2160: Fixed assertion in pjlib test due to uninitialized ioqueue op keys.

Note: See TracTickets for help on using tickets.