Opened 9 years ago

Closed 9 years ago

#1862 closed defect (fixed)

Fixed crash on iOS when destroying an activesock and creating a new one at the same time

Reported by: ming Owned by: bennylp
Priority: normal Milestone: release-2.4.5
Component: pjlib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description

It happens because there is a race condition when two threads try to destroy CFStream in activesock. The stack trace of the crash will look like this:

Thread 17 Crashed:
0   0x0000000183ba95a8 CFRelease + 1084
1   0x000000010045f81c activesock_create_iphone_os_stream (activesock.c:139)
2   0x000000010045a7fc ioqueue_dispatch_write_event (ioqueue_common_abs.c:280)
3   0x000000010045c4c8 pj_ioqueue_poll (ioqueue_select.c:966)
4   0x00000001004777ac worker_proc (endpoint.c:350)
5   0x000000010045d300 thread_main (os_core_unix.c:523)
 
Thread 18:
0   0x00000001953eb0c0 __psynch_mutexwait + 8
1   0x000000010045d1e4 pj_mutex_lock (os_core_unix.c:1243)
2   0x00000001004623ac pj_grp_lock_acquire (lock.c:180)
3   0x000000010045c094 pj_ioqueue_unregister (ioqueue_common_abs.c:1323)
4   0x0000000100460004 pj_activesock_close (activesock.c:305)
5   0x00000001004b679c tcp_destroy (sip_transport_tcp.c:830)
6   0x00000001004b6c1c tcp_destroy_transport (sip_transport_tcp.c:784)
7   0x00000001004b3c20 destroy_transport (sip_transport.c:1153)
8   0x00000001004b39cc transport_idle_callback (sip_transport.c:1232)
9   0x000000010046a1fc pj_timer_heap_poll (timer.c:762)
10 0x00000001004afbb8 pjsip_endpt_handle_events2 (sip_endpoint.c:723)
11 0x00000001004de5fc worker_thread (pjsua_core.c:1982)
12 0x000000010045d300 thread_main (os_core_unix.c:523)

Change History (2)

comment:1 Changed 9 years ago by ming

  • Component changed from applications to pjlib

comment:2 Changed 9 years ago by ming

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

In 5119:

Fixed #1862: Crash on iOS when destroying an activesock and creating a new one at the same time

Thanks to Itay Bianco for the report.

Note: See TracTickets for help on using tickets.