Summary:ASTERISK-04188: CLI Does not get output from issued commands, freezes on TAB after 4053
Reporter:silik0n (silik0n)Labels:
Date Opened:2005-05-16 10:03:58Date Closed:2011-06-07 14:04:48
Versions:Frequency of
Environment:Attachments:( 0) managerpoll.txt
Description:Asterisk Appears to start ok, and commands seem to be executed, however there is not response to the CLI. The socket gets the commands but it appears no answers are returned to the socket.

socket perms ok
tested with new check out and default config files

noted several signedness errors, however about 5/7 or 5/8 it was still working.


I will do some more debugging to see if I can isolate the problem.
Comments:By: Kaj J. Niemi (kajtzu) 2005-05-16 13:21:35

Same thing on x86_64

By: Kaj J. Niemi (kajtzu) 2005-05-16 14:01:43

The cli reverts to working condition if you back out what was committed as revision 1.95 to manager.c.

By: silik0n (silik0n) 2005-05-16 14:41:06

Confirmed on OSX Tiger as well..

asterisk ken$ cvs diff -u
cvs server: Diffing .
Index: manager.c
RCS file: /usr/cvsroot/asterisk/manager.c,v
retrieving revision 1.96
diff -u -r1.96 manager.c
--- manager.c   15 May 2005 03:21:51 -0000      1.96
+++ manager.c   16 May 2005 19:39:34 -0000
@@ -94,10 +94,6 @@
       int res=0;
       struct pollfd fds[1];
       while(len) {
-               /* Wait until writable */
-               res = poll(fds, 1, timeoutms);
-               if (res < 1)
-                       return -1;
               res = write(fd, s, len);
               if ((res < 0) && (errno != EAGAIN)) {
                       return -1;
cvs server: Diffing agi  ---- SNIP ----

cvs diff -u  of the entire tree so we can see the issues

By: silik0n (silik0n) 2005-05-16 19:30:39

This appears to be the result of the patch for 4053. We might need to look at a better way to do this and possibly consolidate this with 4053

By: Brian West (bkw918) 2005-05-16 21:15:04

Same thing on x86_32 also.  Just press tab and watch it lock smooth up.


By: Russell Bryant (russell) 2005-05-17 13:29:55

Can someone give me access to a box where you can recreate this issue?  I haven't been able to, but I believe that I may have a fix.

By: Russell Bryant (russell) 2005-05-17 13:42:42

patch uploaded to take a stab at this.  fds was not initialized before that first call to poll.  I'm not sure this is really even the real solution to the original manager deadlock problem, but it does appear to be a bug in the patch that went in...

By: silik0n (silik0n) 2005-05-17 14:16:32

actually thats a good catch... since fd is not initialized thats causing the hand... moving fds = fd up should solve the problem and appears to do so.

resolves issue on OSX and x86-32

By: Russell Bryant (russell) 2005-05-17 14:27:42

I have committed a fix to CVS that should take care of this issue.

fds was not initalized, and that is what caused this problem.  However, this call to poll should not be there, since the function assumes that the fd is non-blocking.

We will have to find the root cause of the manager deadlock, a place where carefulwrite is called on a blocking fd, and fix it there.