Summary: | ASTERISK-27058: Deadlock in ICE / SRTP | ||||
Reporter: | Michael Walton (mike@farsouthnet.com) | Labels: | |||
Date Opened: | 2017-06-15 15:33:14 | Date Closed: | 2017-06-15 15:39:37 | ||
Priority: | Major | Regression? | |||
Status: | Closed/Complete | Components: | Resources/res_rtp_asterisk | ||
Versions: | 13.17.0 14.5.0 | Frequency of Occurrence | Occasional | ||
Related Issues: |
| ||||
Environment: | N/A | Attachments: | ( 0) res_rtp_asterisk-turn-deadlock-fix.patch | ||
Description: | Occasionally, when using chan_sip (and possibly PJSIP) with WebRTC ICE/SRTP and a TURN service, the Asterisk instance will encounter deadlock between the PJNATH timer_worker_thread and ioqueue_worker_thread.
I have a "special" version of Asterisk 11 where I've ported PJProject 2.6 because of the many deadlock issues of earlier versions of PJNATH, and found this deadlock still exists. I believe it is also as a result present in Asterisk 13 and 14. The problem comes down to the classic potentially unordered use of multiple locks, for which the "group lock" was introduced in PJ (https://trac.pjsip.org/repos/ticket/1617). Unfortunately, this group lock has not been used consistently from res_rtp_asterisk. In particular, when pj_turn_sock_create() is called, it is passed a NULL instead of the existing group lock for the ICE session, causing PJ to allocate a new lock for TURN. And the potential for deadlock. | ||||
Comments: | By: Asterisk Team (asteriskteam) 2017-06-15 15:33:16.086-0500 Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report. Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process]. By: Michael Walton (mike@farsouthnet.com) 2017-06-15 15:43:31.979-0500 Are you certain it's a dup? My stack traces are different I think. I have a 3 line patch to fix, I'll attach now. By: Asterisk Team (asteriskteam) 2017-06-15 15:43:32.107-0500 This issue has been reopened as a result of your commenting on it as the reporter. It will be triaged once again as applicable. By: Joshua C. Colp (jcolp) 2017-06-15 15:48:52.647-0500 It's the same underlying problem. By: Michael Walton (mike@farsouthnet.com) 2017-06-15 15:52:23.625-0500 Patch against 13.16.0 By: Michael Walton (mike@farsouthnet.com) 2017-06-15 15:53:40.817-0500 I'm pretty confident that's a fix for the issue I saw (although someone will have to check the ao2_ref requirements for rtp->ice, if applicable) By: George Joseph (gjoseph) 2017-06-20 10:22:48.724-0500 Michael, can you attach your patch to ASTERISK-27023? |