[Home]

Summary:ASTERISK-11379: Asterisk 1.6-beta2 on Mac Intel extrange CLI operation
Reporter:adria vidal (adriavidal)Labels:
Date Opened:2008-02-05 13:57:14.000-0600Date Closed:2008-07-28 14:46:00
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 1.6.0-configure.patch
( 1) 1.6.0-configurev2.patch
Description:Compiled 1.6.-beta2 as root into my MacBook Intel.
When i run it as:

sudo asterisk

then get into as:

sudo asterisk -vvr

any command i put into the cli is ignored, even if i try the autocomplet function with tab something extrange is wrote into the console (see example below)


If i run asterisk like root making asterisk -vvvvvvvvvc
everything seems ok.







****** ADDITIONAL INFORMATION ******

Macintosh:asterisk-1.6.0-beta2 adriavidal$ sudo asterisk
Macintosh:asterisk-1.6.0-beta2 adriavidal$ sudo asterisk -vvr
Asterisk 1.6.0-beta2, Copyright (C) 1999 - 2008 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
NOTE: This is a development version of Asterisk, and should not be used in
production installations.
 == Parsing '/etc/asterisk/asterisk.conf':   == Found
 == Parsing '/etc/asterisk/extconfig.conf':   == Found
Connected to Asterisk 1.6.0-beta2 currently running on Macintosh (pid = 7701)
Macintosh*CLI> core sip show channels
Macintosh*CLI> 2co
Macintosh*CLI>
Comments:By: Brandon Kruse (bkruse) 2008-02-08 16:36:48.000-0600

What about asterisk -rx 'core show version'

Have you tried another terminal app possibly?

I will look into this and see if I can find anything


-bk

By: Tilghman Lesher (tilghman) 2008-02-08 18:27:00.000-0600

"core sip show channels" is not a real command.

By: Tilghman Lesher (tilghman) 2008-02-08 18:46:25.000-0600

Oh, and the correct way to launch Asterisk on OS X is:  launchd -d asterisk -f

Asterisk will no longer background itself on OS X (10.4 and above), because Apple has deprecated the use of the daemon(3) API call and recommends using "launchd -d" to daemonize server processes.

By: Tilghman Lesher (tilghman) 2008-02-08 18:51:25.000-0600

It appears to be a problem of buffering.  When you call the command, the output is, in fact, written (you can verify this with ktrace), but it's getting buffered somewhere and is never arriving on the destination console.  Note that if you start up asterisk with:

sudo asterisk -vvc

and connect with:

sudo asterisk -rc

You can type "stop now" on either console, and the opposite console does not react.  If you type it on the remote console, then it doesn't take effect until you "quit" (which would cause the buffer to get flushed).  If you type it on the local console, then Asterisk quits immediately, but the remote console looks as if it's still connected (and won't react at all until you hit the Enter key and it realizes the other end of the pipe is closed).

By: Tilghman Lesher (tilghman) 2008-02-08 19:35:03.000-0600

In main/asterisk.c, in netconsole, if you reverse the order of the fds in the poll, then you lose even the ability to write commands.  So I think there's something peculiar on OS X with respect to the poll(2) kernel API.

By: Mark Michelson (mmichelson) 2008-04-16 15:46:18

In 1.6, Mac OSX uses the system poll(2) call as opposed to a version of poll() defined in the Asterisk source (which actually uses select(2) instead). Googling reveals that apparently on Mac OSX, poll(2) is somewhat buggy, and so instead of using it, perhaps the old method of disguising a select(2) as poll(2) should instead be used. I will upload a patch which does this.

For reference, I will note that this patch is similar to the patch posted on ASTERISK-9876 and ASTERISK-9989, however that patch is for 1.4 and is intended to fix a similar (and yet worse) problem with poll() use in Asterisk with Mac OSX.

By: Mark Michelson (mmichelson) 2008-04-16 17:13:08

The attached patch may solve the issue you're having. To use it, apply the patch and then re-run configure like so:

./configure --enable-internal-poll

Then recompile Asterisk. This will use Asterisk's poll implementation instead of the system poll. Please try it out and see if it fixes the problem. Thanks!

By: adria vidal (adriavidal) 2008-04-18 19:13:34

Thanks putnopvut  for the goog work. If i run asterisk as root with
asterisk -vvvvc  (here all commands are fine)
and then from another terminal as a normal user do a sudo asterisk -vvr
(here all the commands are broken) autocompletion seems part of the problem:

Macintosh*CLI> 1sip

But some of them are well completed sometimes.
Really don't understand what is happening.

By: Joshua C. Colp (jcolp) 2008-05-28 10:28:02

This should be fixed in the current tree. Please update and report back.

By: adria vidal (adriavidal) 2008-05-28 10:50:19

Ok will try to get the new version and post a reply, thanks.



By: Joshua C. Colp (jcolp) 2008-05-28 10:51:57

Don't use the patch. What revision are you trying?

By: adria vidal (adriavidal) 2008-05-29 15:19:27

Compiled svn

Asterisk 1.6.0-beta9 built by adriavidal @ Macintosh.local on a i386 running Darwin on 2008-05-29 20:01:24 UTC

but seems to fail the same when:
sudo asterisk -vvvc

and then
sudo asterisk -vvr


trying to do a "sip show peers"

put on CLI:

Macintosh*CLI> 0_EOF_ p

if put without autocompletion sip show peers nothing is put on screen.

By: Joshua C. Colp (jcolp) 2008-05-29 15:25:52

You are building from a tag that would not have gotten the changes.

Please use http://svn.digium.com/svn/asterisk/branches/1.6.0

By: Joshua C. Colp (jcolp) 2008-06-10 10:22:12

Since the autoconf changes fixed it for both Mark and myself, and there has been no response in over a week I am confident this has been solved.

By: adria vidal (adriavidal) 2008-06-11 03:08:56

Sorry the problem was at my home/devel machine and had no acces to internet for some time.

Yesterday downloaded the right version but still getting the same problem.
How are you and Mark starting you Asterisk in yours Macs?

By: Mark Michelson (mmichelson) 2008-06-23 12:41:35

I'm back on this again. I was able to reproduce the strange behavior on the CLI and this time I wrote a patch to the configure script that appears to be working on the Mac Mini in my office. I have uploaded 1.6.0-configurev2.patch. If you patch your 1.6.0 installation with this and run `./configure --enable-internal-poll` you will revert to using Asterisk's internal poll, which cleared the problem for me.

By: Digium Subversion (svnbot) 2008-07-28 14:45:56

Repository: asterisk
Revision: 134125

U   trunk/CHANGES
U   trunk/configure
U   trunk/configure.ac
U   trunk/main/Makefile

------------------------------------------------------------------------
r134125 | mmichelson | 2008-07-28 14:45:55 -0500 (Mon, 28 Jul 2008) | 27 lines

This commit compensates for buggy poll(2)
implementations. Asterisk has, for a long time,
had its own implementation of poll(2) which
just used the input arguments to call select(2).
In 1.4, this internal implementation was used
for Darwin systems. This was removed in Asterisk
trunk at some point, but it seems as though this
was not the right move to make.

On Mac OS X, it appears as though the poll used
to gather CLI input does not respond properly
when connecting via a remote Asterisk console.
Reverting to the use of Asterisk's poll fixed
the issue.

Also, there is now an option for the configure
script, --enable-internal-poll, which will allow
for anyone to use Asterisk's internal poll
implementation in case they suspect that their
system's poll implementation is buggy.

closes issue ASTERISK-11379)
Reported by: adriavidal
Patches:
     1.6.0-configurev2.patch uploaded by putnopvut (license 60)


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=134125