[Asterisk-Users] Asterisk on FreeBSD 4.10 dies

Dr. Rich Murphey rich at WhiteOakLabs.com
Mon Jul 12 06:12:44 MST 2004


Differences in how poll() works is probably responsible.

Try this and see if it helps.

Cheers,
Rich
 

> -----Original Message-----
> [mailto:asterisk-users-admin at lists.digium.com] On Behalf Of Arjan
> 
> On Sun, 11 Jul 2004 at 16:03 -0500, Dr. Rich Murphey wrote:
> 
> > That sounds like a bug.  One should be able to attach to 
> the process 
> > in gdb, stop the process and see where it's looping.
> 
> I'm going to pretend here and now that I'm a hardcore 
> debugger (with a little help of my local debug-guru haha):
> 
> --- ktrace output coming up -
> 44392 asterisk RET   read 0
> 44392 asterisk CALL  poll(0xbfa76fb4,0x1,0)
> 44392 asterisk RET   poll 1
> 44392 asterisk CALL  read(0x12,0x284fd0a0,0x100)
> 44392 asterisk GIO   fd 18 read 0 bytes
> 
> root     asterisk   44392   18 /var      22833 prwx------ 0  r
> ---
> root at shell$ find /var -inum 22833
> /var/run/autodial.ctl
> 
> A backtrace in gdb comes up with:
> 
> #0  0x28142d64 in __sys_read () from /usr/lib/libc_r.so.4
> #1  0x2813f1a0 in _read () from /usr/lib/libc_r.so.4
> #2  0x2813f1fa in read () from /usr/lib/libc_r.so.4
> #3  0x284fafaf in autodial (ignore=0x0) at pbx_wilcalu.c:83
> #4  0x28105240 in _thread_start () from /usr/lib/libc_r.so.4
> #5  0x0 in ?? ()
> 
> Does this make any sense ?
> 
> arjan
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
> 
> 
> 
-------------- next part --------------
Index: pbx_wilcalu.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx/pbx_wilcalu.c,v
retrieving revision 1.14
diff -u -r1.14 pbx_wilcalu.c
--- pbx_wilcalu.c	22 Jun 2004 18:49:00 -0000	1.14
+++ pbx_wilcalu.c	12 Jul 2004 13:09:24 -0000
@@ -74,11 +74,18 @@
 	while(1){
 		ssize_t bytes;
 		void *pass;
+                int ret = 0;
 
 		memset(buf,0,257);
 		fds[0].fd = fd;
 		fds[0].events = POLLIN;
-		poll(fds, 1, -1);
+		ret = poll(fds, 1, -1);
+                if ((ret < 0) &&
+                    ( (fds[0].revents == POLLHUP) ||
+                      (fds[0].revents == POLLHUP))) {
+                	ast_log(LOG_ERROR, "Autodial: cannot poll dial file: %s\n", dialfile);
+                        pthread_exit(NULL);
+                }
 		bytes=read(fd,buf,256);
 		buf[(int)bytes]=0;
 


More information about the asterisk-users mailing list