Ticket #2160 (closed defect: fixed)

Opened 7 days ago

Last modified 7 days ago

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

comment:1 Changed 7 days ago by ming

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

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.
Note: See TracTickets for help on using tickets.