[Asterisk-Dev] hang in ast_read/capi_read? Debug suggestions?
Philip Warner
pjw at rhyme.com.au
Thu Apr 21 05:12:24 MST 2005
I am using * from a CVS on the 16th, and I have a Fritz card used to
receive incoming calls (with patches to make it work with the latest CVS).
It works fine in normal circumstances. I added:
exten => s,1,Wait,2
to the start of the initial context the ISDN call comes into, and it waited
too short a time, so I changed it to:
exten => s,1,Wait,12
Now, the Wait never returns.
Using 'capi debug' in the console produces no errors. I have attached to *
using gdb, both before and after the timer would run out, and I see the
following differences:
BEFORE expiry:
Thread 2 (Thread 1089379248 (LWP 3716)):
#0 0xffffe410 in ?? ()
#1 0x40ee33d8 in ?? ()
#2 0x00002ee0 in ?? ()
#3 0x00000002 in ?? ()
#4 0x401aa494 in poll () from /lib/tls/libc.so.6
#5 0x08061df7 in ast_waitfor_nandfds (c=0x40ee34f0, n=1, fds=0x0, nfds=0,
exception=0x0, outfd=0x0, ms=0x40ee34f4)
at channel.c:1113
#6 0x08062577 in ast_waitfor_n (c=0xfffffffc, n=-4, ms=0xfffffffc) at
channel.c:1182
#7 0x080632e5 in ast_waitfor (c=0x40f00630, ms=12000) at channel.c:1189
#8 0x080635f2 in ast_safe_sleep (chan=0x40f00630, ms=12000) at channel.c:581
#9 0x08080dcd in pbx_exec (c=0x40f00630, app=0x80fd318, data=0x40ee7700,
newstack=1) at pbx.c:528
#10 0x08081d01 in pbx_extension_helper (c=0x40f00630, con=Variable "con" is
not available.
) at pbx.c:1640
#11 0x08083068 in ast_pbx_run (c=0x40f00630) at pbx.c:2289
#12 0x0808441f in pbx_thread (data=0xfffffffc) at pbx.c:2470
#13 0x400447f3 in start_thread () from /lib/tls/libpthread.so.0
#14 0x401b362a in clone () from /lib/tls/libc.so.6
AFTER expiry:
Thread 2 (Thread 1088674736 (LWP 3633)):
#0 0xffffe410 in ?? ()
#1 0x40e37498 in ?? ()
#2 0x00000030 in ?? ()
#3 0x08131060 in ?? ()
#4 0x40048f8b in __read_nocancel () from /lib/tls/libpthread.so.0
#5 0x404609f7 in capi_read (c=0xfffffe00) at chan_capi.c:949
#6 0x08061833 in ast_read (chan=0x40f00668) at channel.c:1415
#7 0x080635d5 in ast_safe_sleep (chan=0x40f00668, ms=2) at channel.c:585
#8 0x08080dcd in pbx_exec (c=0x40f00668, app=0x80fd318, data=0x40e3b700,
newstack=1) at pbx.c:528
#9 0x08081d01 in pbx_extension_helper (c=0x40f00668, con=Variable "con" is
not available.
) at pbx.c:1640
#10 0x08083068 in ast_pbx_run (c=0x40f00668) at pbx.c:2289
#11 0x0808441f in pbx_thread (data=0xfffffe00) at pbx.c:2470
#12 0x400447f3 in start_thread () from /lib/tls/libpthread.so.0
#13 0x401b362a in clone () from /lib/tls/libc.so.6
and it stays like this until the caller hangs up.
The relevant code is:
int ast_safe_sleep(struct ast_channel *chan, int ms)
{
struct ast_frame *f;
while(ms > 0) {
ms = ast_waitfor(chan, ms);
if (ms <0)
return -1;
if (ms > 0) {
??? f = ast_read(chan);
if (!f)
return -1;
ast_frfree(f);
}
}
return 0;
}
...in my case, ms is 2, so the '???' bit gets called.
I don't know enough about the internals of this to understand what is going
on.
Naievely, I wondered if capi_read should return at all if the call has not
yet been answered, so I added an 'Answer' before the 'Wait', and the
problem went away. But this is not an option in the dialplan.
I would appreciate any insights or suggestions for further investigation.
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 03 5330 3172 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp.mit.edu:11371 |/
More information about the asterisk-dev
mailing list