Summary:ASTERISK-03302: Gastman command window history mechanism causes crashes, needs work
Reporter:Steve Murphy (murf)Labels:
Date Opened:2005-01-18 10:38:24.000-0600Date Closed:2011-06-07 14:10:46
Versions:Frequency of
Description:Gastman, in the command window, has some definite probs when the output gets big.
Right now, if I were in an asterisk -r session, a 'database show' command would yield 36K of output.
I've modified gastman to have 8000 chars of history, and only 8193 chars of output are shown by gastman for the same command. It "feels" like a buffer overflowed, because a crash will result with more poking around.

****** STEPS TO REPRODUCE ******

build a database with hundreds of elements. Have at least 35K of data generated when you type "database show". Then do a 'database showkey tree/key' twice on the same key. For me, the  second showkey command results always in crash in the gtk code. If you don't do a "database show" first, you can type these same showkey commands dozens of times with no problems.


I get the "feel" that gastman was not written with large datasets/command histories in mind.
Comments:By: Tilghman Lesher (tilghman) 2005-01-18 11:28:25.000-0600

This is not about command history; command history supports up to 1000 commands.  Instead, this is about output capacity per command, which is currently 1000 characters per line and 256 lines.  If you wish to increase this, you can change MAX_HEADERS and MAX_LEN in gastman.c and recompile.

By: Steve Murphy (murf) 2005-01-18 12:11:45.000-0600

Uh, excuse me! You might recommend some values for the above, as when I increase either or both, the behavior of the program does not change! the output is still chopped to 8192 chars, and the program still crashes in the exact same manner.
The only difference I can see is the program takes an extra second or two to start up and be ready for action.

edited on: 01-18-05 12:13

By: nick (nick) 2005-01-18 13:11:24.000-0600

I wouldn't conisider 'not crashing' a feature request... please read and choose carefully before opening bugs.

By: Steve Murphy (murf) 2005-01-18 13:36:43.000-0600


didn't realize I had that field set, left over from a previous submission. Yes, this is meant to be a real live bug report. But, gastman doesn't have a category for bugs to be reported anyway (as far as I could see).

By: twisted (twisted) 2005-01-18 15:30:33.000-0600

That's because gastman is a different project than Asterisk, and this is the asterisk bug tracker.

By: Mark Spencer (markster) 2005-02-06 21:50:40.000-0600

Well, in the absense of a "gastman bugtracker" i think we'll have to keep the discussion here.  Can you tell if it has to do with the width of the columns or the total datasize?  I've tried duplicating this crash without success...

By: Mark Spencer (markster) 2005-02-11 01:19:45.000-0600

Okay one last try to solicit a response...  Is the problem the width of the columns or total datasize?

By: Steve Murphy (murf) 2005-02-11 08:42:39.000-0600

Sorry-- I've been a bit busy. I'll try to determine which today. I have
some ideas as to things to try.

By: Mark Spencer (markster) 2005-02-19 15:20:22.000-0600

Any more progress?

By: Steve Murphy (murf) 2005-02-21 00:02:31.000-0600

Sorry for the wait. I've been up to my ears these days.

This is what I've done so far. I checked out gastman by these steps:

export CVSROOT=:pserver:anoncvs@cvs.digium.com:/usr/cvsroot
cvs login
cvs checkout gastman
cd gastman
make install

This ie pretty elementary, I know, but I have made mods to my current
gastman to avert crashes, and who knows but what I've hozed myself royal
in the process, and got you all worked up over nothing.

Actually, I did two make installs, one on the same machine asterisk is running on, which was kinda useless, as it doesn't run an X server, and the other
on the system where I do have an X server running. I ran from the other machine.

I'm running on Fedora Core 3. I'd bet anything the debian guys on the mailing lists would say that this is my first mistake...!

Once in gastman, and logged into the server, I simply did:

database show

and then:

database show

again. Gastman crashes this time, its window winking out of existence...

I took the results of the first command, and copied it all into a file.
I then did 'ls -l' on the file: size is 8193 bytes. Hmmm. It's cut short
at the end, right in the middle of a line of output. Actually, only a quarter
of the total output is shown.

So, you ask, is it the because of long lines? I don't think so. The longest line is 113 chars long. The rest seem to average somewhere near 80.

Is it because of too many lines? The 8193 chars spanned 105 lines. Looks to me like 8192 ia the magic number here.

By: Steve Murphy (murf) 2005-02-21 00:12:00.000-0600

Hmmm. more info.

I just tried the whole thing one more time. And I could do one
'database show' after another after another with no problems.

I tried interspersing some "help database" and other smaller commands,
no crash.

Hmmm. Was I using a different version? No.

What else did I do that might cause the crash? Um, I did copy and paste
from the gastman window into a file via vi, so I could measure the output...
I did that again, and BAM! a crash on the next "database show".

So, it looks copy/paste is a factor. I hadn't suspected this previously! I shake my head. The fuzzy line between superstition and science.

By: Mark Spencer (markster) 2005-02-21 00:21:30.000-0600

I cannot duplicate this at all.  Could it be related to the version of gtk you have installed?

By: Tilghman Lesher (tilghman) 2005-02-21 00:39:33.000-0600

Are you perhaps using GTK 1.2?  The lastest 1.2 version was released in 2001 and has not had any maintenance patches released since that date, and it is highly unlikely there will be any.  If you're not already on 2.x, you should probably upgrade soon.

The installed versions can be obtained by the commands:
gtk-config --version
pkg-config --modversion gtk+-2.0

By: Steve Murphy (murf) 2005-02-21 11:05:15.000-0600

Hmmm. It seems to be boiling down to a config issue?  As I've reported
before, I'm running FC3.

There is no gtk-config. The blurb for FC3 says I'm using gnome 2.8. I'm using
evolution 2.0.2;

pkg-config --modversion gtk+-2.0 returns:


Here's a list of packages installed that have gtk in the title:


And, looking in /usr/lib, here's what there is that has gtk in the
file or dirname:

ls *gtk*
libgconf-gtk-1.so.1      lib-gnu-java-awt-peer-gtk.so.5      libgtkembedmoz.so        libgtkhtml-2.so.0.0.0      libgtksourceview-1.0.so.0.0.0  libgtk-x11-2.0.so           libgtkxmhtml.so.1.0.1
libgconf-gtk-1.so.1.0.0  lib-gnu-java-awt-peer-gtk.so.5.0.0  libgtkhtml-1.1.so.3      libgtkhtml-3.1.so.11       libgtkspell.so.0               libgtk-x11-2.0.so.0         libgtkxtbin.so
libgnorbagtk.so.0        libgtk-1.2.so.0                     libgtkhtml-1.1.so.3.0.4  libgtkhtml-3.1.so.11.0.4   libgtkspell.so.0.0.0           libgtk-x11-2.0.so.0.400.14
libgnorbagtk.so.0.0.0    libgtk-1.2.so.0.9.1                 libgtkhtml-2.so.0        libgtksourceview-1.0.so.0  libgtksuperwin.so              libgtkxmhtml.so.1


2.4.0  include  modules


----------- And here's what's in gtk-2.0

[root@monster lib]# ls gtk-2.0/*
engines  filesystems  immodules  loaders


libatk-bridge.la  libatk-bridge.so  libdwellmouselistener.so  libferret.la  libferret.so  libgail-gnome.la  libgail-gnome.so  libgail.la  libgail.so  libkeymouselistener.so

This may boild down to some magic in the makefile?

By: Mark Spencer (markster) 2005-02-26 10:43:53.000-0600

Will gastman run under valgrind?

By: Steve Murphy (murf) 2005-02-26 18:10:46.000-0600

Gastman compiles with -g as-is, so I fired it up under the debugger and
did my stuff.

I tried "show application dial" and selected some text from that.
Then I did "show application dial" again. No crash. So I selected text
again, and did "show application gotoif" and no crash. Then did a
"database show", whose output was cut off at 8k, and then selected text,
a couple lines, then did another "database show", and bang, a crash.

Here's the stack trace:

(gdb) where
#0  0x0027260d in gtk_text_set_point () from /usr/lib/libgtk-x11-2.0.so.0
#1  0x00273908 in gtk_text_set_point () from /usr/lib/libgtk-x11-2.0.so.0
#2  0x00af63ae in g_cclosure_marshal_VOID__VOID () from /usr/lib/libgobject-2.0.so.0
#3  0x00ade347 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#4  0x00af4ae1 in g_signal_has_handler_pending () from /usr/lib/libgobject-2.0.so.0
ASTERISK-1  0x00af5cbc in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
ASTERISK-2  0x00255383 in gtk_signal_emit_by_name () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-3  0x0026fdd0 in gtk_text_freeze () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-4  0x00271a8b in gtk_text_set_point () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-5  0x00271c4d in gtk_text_set_point () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-6 0x00276696 in gtk_text_set_adjustments () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-7 0x00276757 in gtk_text_thaw () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-8 0x08057fbf in gui_cli_result (
   s=0x80e6540 "/IAX/Registry/murfiaxphone", ' ' <repeats 24 times>, ":  \n/RyanDirect/3075275310", ' ' <repeats 28 times>, ": 1", ' ' <repeats 24 times>, "\n/RyanDirect/3075275822", ' ' <repeats 22 times>...) at gui.c:2040
ASTERISK-9 0x0805028a in gastman_run_command (cmd=0x8823d78 "database show") at gastman.c:1368
ASTERISK-10 0x080544d3 in command_ready (widget=0x881b630, data=0x0) at gui.c:1023
ASTERISK-11 0x00af63ae in g_cclosure_marshal_VOID__VOID () from /usr/lib/libgobject-2.0.so.0
ASTERISK-12 0x00ade347 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
ASTERISK-13 0x00af4ae1 in g_signal_has_handler_pending () from /usr/lib/libgobject-2.0.so.0
ASTERISK-14 0x00af6287 in g_signal_emitv () from /usr/lib/libgobject-2.0.so.0
ASTERISK-15 0x001517d3 in gtk_bin_get_child () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-16 0x00152a57 in gtk_binding_set_by_class () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-17 0x00152cae in gtk_binding_set_by_class () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-18 0x00152ef1 in gtk_bindings_activate_event () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-19 0x003023e9 in gtk_widget_activate () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-20 0x001b010d in gtk_entry_set_visibility () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-21 0x0020e757 in gtk_marshal_VOID__UINT_STRING () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-22 0x00ade6b2 in g_cclosure_new_swap () from /usr/lib/libgobject-2.0.so.0
ASTERISK-23 0x00ade347 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
ASTERISK-24 0x00af4646 in g_signal_has_handler_pending () from /usr/lib/libgobject-2.0.so.0
ASTERISK-25 0x00af5913 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
ASTERISK-26 0x00af5f5a in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
ASTERISK-27 0x00302545 in gtk_widget_activate () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-28 0x00312c16 in gtk_window_propagate_key_event () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-29 0x003177cb in gtk_window_activate_key () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-30 0x0020e757 in gtk_marshal_VOID__UINT_STRING () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-31 0x00ade6b2 in g_cclosure_new_swap () from /usr/lib/libgobject-2.0.so.0
ASTERISK-32 0x00ade347 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
ASTERISK-33 0x00af4646 in g_signal_has_handler_pending () from /usr/lib/libgobject-2.0.so.0
ASTERISK-34 0x00af5913 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
ASTERISK-35 0x00af5f5a in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
ASTERISK-36 0x00302545 in gtk_widget_activate () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-37 0x0020cb6a in gtk_propagate_event () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-38 0x0020cd20 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-39 0x00c3e0a2 in gdk_event_get_graphics_expose () from /usr/lib/libgdk-x11-2.0.so.0
ASTERISK-40 0x00a567bb in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
ASTERISK-41 0x00a58242 in g_main_context_acquire () from /usr/lib/libglib-2.0.so.0
ASTERISK-42 0x00a584ef in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
ASTERISK-43 0x0020c07e in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
ASTERISK-44 0x08056d95 in gui_run () at gui.c:1604
ASTERISK-45 0x080511a4 in manage_calls (host=0xbff02730 "phone") at gastman.c:1706
ASTERISK-46 0x080517f6 in main (argc=0, argv=0xbff028c8) at gastman.c:1868

By: Mark Spencer (markster) 2005-03-10 02:58:39.000-0600

This is pretty much meaningless.  Try it under valgrind and see if you can find the real cause.  Without more information, I guess I have to just shrug this off as a GTK issue, as I cannot duplicate this.

By: Brian West (bkw918) 2005-03-17 21:14:29.000-0600

Murf if this is still a problem please find someone to reopen it or I think you'll be able to do it.  If not find someone in #asterisk-bugs.