<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div>I've been testing Asterisk 1.4.18-rc4 for several days and one things got me puzzled. While locking contention seems resolved from 1.4.17, another odd thing came up in testing. I'm using Debian Etch with Linux Kernel 2.6.23.11. I did have DEBUG_THREADS and DETECT_DEADLOCKS enabled, as well as MALLOC_DEBUG and DONT_OPTIMIZE.</div><div><br class="webkit-block-placeholder"></div>In an app I've been working on, I call ast_waitfordigit in a tight loop that waits for a variable (an int) set by another thread to change or events via ast_waitfordigit. I call it with a 1000 ms timeout. During times of heavy use, I find that calls are waiting in ast_waitfordigit much longer than they should. In many cases, the variable has been set so the loop should exit (and it can't restart) which leads me to ast_waitfordigit. I can verify this using gdb (I generated a core file and analyzed it after the fact.) About 10 of 29 threads waiting in ast_waitfordigit could exit when ast_waitfordigit terminates. None did for at least 20 seconds.<div><br class="webkit-block-placeholder"></div><div>The odd thing is that looking at the "start' variable in ast_waitfor_nandfds (called by ast_waitfordigit), all 29 threads were started with in 2 ms of each other, many within a few ns. This seems highly suspect. Perhaps the call to ast_channel_lock in ast_waitfor_nandfds was blocking (in the poll syscall) way, way too long. However, this didn't appear to be the case in gdb since none were stuck there. Perhaps ast_channel_lock somehow synchronized the threads?</div><div><br class="webkit-block-placeholder"></div><div>Any ideas?</div><div><br><div> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div><div>Norman Franke</div><div>Answering Service for Directors, Inc.</div><div>www.myasd.com</div></div></span></span></span> </div><br></div></body></html>