Summary: | ASTERISK-12497: [patch] DAHDI mwi thread race conditions, sometimes crash or output wierd noises on the call | ||
Reporter: | Brett Bryant (bbryant) | Labels: | |
Date Opened: | 2008-07-31 18:04:03 | Date Closed: | 2008-08-26 16:50:40 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Channels/chan_dahdi |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) bt.txt ( 1) chan_dahdi.diff | |
Description: | DAHDI appears to have a race condition in do_monitor where it can spawn two instances of mwi_send_data for the same dahdi_pvt structure if the ioctl for DAHDI_MWT fails around line 7922. Attached is a backtrace of a crash that can occur with this issue. My test environment is asterisk trunk r134352 and dahdi r4590 with a 4 port analog card. The test was just picking up the analog phone, and having it drop into an immediate context that just played back a file. Here are the debug messages, accompanied by 'dialup like' noises on the analog phone: [Jul 31 18:09:53] DEBUG[25958]: chan_dahdi.c:7914 do_monitor: Unable to control message waiting led on channel 4: Inappropriate ioctl for device [Jul 31 18:09:53] DEBUG[25963]: chan_dahdi.c:5558 dahdi_write: Dropping frame since I've still got a callerid spill [Jul 31 18:09:54] DEBUG[25963]: chan_dahdi.c:5558 dahdi_write: Dropping frame since I've still got a callerid spill [Jul 31 18:09:54] DEBUG[25963]: chan_dahdi.c:5558 dahdi_write: Dropping frame since I've still got a callerid spill [Jul 31 18:09:54] DEBUG[25963]: chan_dahdi.c:5558 dahdi_write: Dropping frame since I've still got a callerid spill [Jul 31 18:09:54] DEBUG[25963]: chan_dahdi.c:5558 dahdi_write: Dropping frame since I've still got a callerid spill [Jul 31 18:09:54] DEBUG[25963]: chan_dahdi.c:1954 restore_conference: Restored conferencing [Jul 31 18:09:54] WARNING[25962]: chan_dahdi.c:7543 mwi_send_thread: MWI Send Write failed: Invalid argument I've attempted a few wierd ways to fix it, but I think the patch just creatively masking the problem instead of fixing it (still, I've attached the patch because it makes it work). | ||
Comments: | By: Russell Bryant (russell) 2008-07-31 18:07:55 Hey Doug, this appears to be related to some recent work that you did. By: Doug Bailey (dbailey) 2008-08-01 15:37:27 I doubt that there are two instances of the mwi_send_thread colliding but instead is the mwi_send_thread colliding with other code that uses the cid variables. The patch's utilization of local variables instead of using those in the dahdi_pvt is a big improvement. I will look for collisions in handling the cid variables to see where mwi_send_thread is treading. By: Doug Bailey (dbailey) 2008-08-20 16:55:28 A branch was made that has the mwi_send_thread functionality rolled back into do_monitor. The original mwi_send_thread was not releasing resources (such as in do_monitor) when asterisk initiated calls were being made. This led to resource conflicts which in tunr caused this error. By rolling the functionality into do_monitor, only the do_monitor thread need be killed to prevent the resource conflict. http://svn.digium.com/svn/asterisk/team/dbailey/13213_mwi By: Digium Subversion (svnbot) 2008-08-26 16:50:37 Repository: asterisk Revision: 140246 U trunk/channels/chan_dahdi.c ------------------------------------------------------------------------ r140246 | dbailey | 2008-08-26 16:50:37 -0500 (Tue, 26 Aug 2008) | 5 lines Move the mwi send thread functionality back into the do_monitor thread so that it is easier to manage CID spill resources when do_monitor needs to be killed. (closes issue ASTERISK-12497) Reported by: bbryant ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=140246 |