experience with stk-3.1 and Sparc-Solaris 2.5.1

From: Thomas Buerger <buerger_at_serv1.iaa.tu-clausthal.de>
Date: Thu, 19 Mar 1998 10:27:31 +0100 (MET)

Dear STK-Users,

here an experience which could be usefull if you have the same or
a similar looking problem: (I still use STk-3.1 because I did not
ported my program yet to STK-3.1.1 but I think the problem is
not 3.1-specific!)

On "SunOS 5.5.1 Generic sun4u sparc SUNW,Ultra-1" stk-3.1 sometimes hang in
a Widget-Callback-Routines. Its behaviour depended on the callback-routine:

IF I called the (gc) within the callback-routine, I got the well known endless
loop:

-------------------------------------------------------------------
  0 WARNING: report-error is buggy!!
 
*** Error:
    Out of storage
Current eval stack:
__________________
  0 WARNING: report-error is buggy!!
 
*** Error:
    Out of storage
Current eval stack:
__________________
  0 WARNING: report-error is buggy!!
 
*** Error:
    Out of storage
Current eval stack:
__________________
  0 WARNING: report-error is buggy!!
 
...
-------------------------------------------------------------------
IF I did NOT call the (gc) within the callback-routine, the system hang and
(sometimes) generated a core-dump. (If not, I generated a core-dump
with gcore). In all cases the stack trace looked like this and ever
ended in realfree() called from malloc (Sun's malloc!)

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

(gdb) bt
#0 0xef5cb964 in realfree ()
#1 0xef5cc110 in _free_unlocked ()
#2 0xef5cc044 in free ()
#3 0x347a4 in STk_free_string_port ()
#4 0x24564 in gc_sweep ()
#5 0x24854 in gc_mark_and_sweep ()
#6 0x24894 in STk_gc_for_newcell ()
#7 0x2cdc4 in STk_cons ()
#8 0x1e418 in STk_handle_signal ()
#9 <signal handler called>
#10 0xef5cb964 in realfree ()
#11 0xef5cc1b8 in cleanfree ()
#12 0xef5cb2cc in _malloc_unlocked ()
#13 0xef5cb1c4 in malloc ()
#14 0x2089c in STk_must_malloc ()
#15 0x348f0 in STk_open_output_string ()
#16 0x1f090 in STk_convert_for_Tk ()
#17 0x1f854 in Tcl_GlobalEval ()
#18 0x85ee0 in TkCopyAndGlobalEval ()
#19 0x44658 in InvokeButton ()
#20 0x42ee8 in ButtonWidgetCmd ()
#21 0x1f1d4 in STk_execute_Tcl_lib_cmd ()
#22 0x309b4 in STk_eval ()
#23 0x209e4 in STk_internal_eval_string ()
#24 0x1f81c in Tcl_GlobalEval ()
#25 0x84a30 in Tk_BindEvent ()
#26 0x8743c in TkBindEventProc ()
#27 0x3e648 in Tk_HandleEvent ()
#28 0x3e9c8 in WindowEventProc ()
#29 0x9d224 in ServiceEvent ()
#30 0x9d468 in Tcl_DoOneEvent ()
#31 0x3ea2c in Tk_MainLoop ()
#32 0x1d8bc in finish_initialisation ()
#33 0x1dc00 in repl_driver ()
#34 0x1dc5c in STk_toplevel ()
#35 0x1d1ec in main ()

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

Two changes seems to solve the problem:
1. replace malloc by Gnu-malloc (Not the one in glibc but the stand-alone one
     if you don't have it you get it from:
     //ftp.tu-clausthal.de/pub/mirror/gnu/prep.ai/malloc.tar.gz)
   - Compile Gnu-malloc,
   - put gmalloc.o in ~/STk-3.1
   - Change ~/STk-3.1/Src/Makefile:
     SOBJ = ../gmalloc.o stk.o ....
2. Prevent signal-handler to do anything when must_malloc is working
   (I don't know if this is really neccessary but in the stack you see
    that the signal-handler is even called during realfree)
----------------------------------------------------------------
diff slib.c slib.c.orig
60,61d59
< extern int STk_in_must_malloc;
<
69,71d66
< /* to prevent signal handler to do anything while in must_malloc */
< STk_in_must_malloc = 1;
<
89,90d83
< STk_in_must_malloc = 0;
<
98,99d90
< STk_in_must_malloc = 1;
<
112,113d102
< STk_in_must_malloc = 0;
<
   ----------------------------------------------------------------
diff signal.c signal.c.orig
36,38d35
< /* to prevent signal handler to do anything while in must_malloc */
< int STk_in_must_malloc = 0;
<
99,100d95
< if (STk_in_must_malloc == 1) return;
<

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

Now my program works stable!

If those problems are already solved in newer version of STk please
tell me and forget this mail.

sincerly, Thomas

-- 
****************************************************************************
INSTITUT FUER APPARATEBAU UND ANLAGENTECHNIK      Dipl.-Ing. Thomas Buerger
     TECHNISCHE UNIVERSITAET CLAUSTHAL            Tel.: (49)5323/953-412
               Am Regenbogen 15                   Fax.: (49)5323/953-499
       D-38678 Clausthal-Z. (Germany)  Email:thomas.buerger_at_tu-clausthal.de
Schwerpunkt: Einsatz der Nahbereichsphotogrammetrie im Anlagenbau.
    Project: Application of close-range-photogrammetry in plant engineering.
*************************************************** FIAT LinUX ;-) ********* 
Received on Thu Mar 19 1998 - 10:56:25 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST