Subject: Re: core dump with fvwm-themes

From: Olivier Chapuis <[email-masked]>
Date: Fri, 06 Oct 2000 20:04:38 +0200

Mikhael Goikhman wrote:
> 
> It is interesting. Olivier reported some hard to spot (unconsistent) core
> dumps. But I myself never got core dumps on my machine. Now, I ran the
> same fvwm on another X Server remotely using rsh and always got core
> dumps. I am attaching 5 core dump outputs (the last 2 are suspicious, they
> are in line 42 (malloc) of safemalloc). I don't know how helpful they are.

If you use glibc-2.1.x there are an intersting paper on memory
debuging at:

http://sdb.suse.de/sdb/en/html/aj_debug.html

I try mtrace but it does not seem that this is useful
with fvwm2. Maybe MALLOC_CHECK_ is more interesting:
if you set this variable to 2, then you may hope to
have "better" core dump.

Olivier
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Mikhael Goikhman <[email-masked]>
Date: Sun, 8 Oct 2000 01:14:03 +0200

> if you set this variable to 2, then you may hope to

Well, I don't see that compiling with -DMALLOC_CHECK_=2 changes anything.

Ok, after a lot of debugging, I have found the first problem (I fear there
are more problems, since I get other meaningless core dumps in malloc.c).

Consider this minimal fvwm rc file:

  Key F11  A  SM  Module FvwmIdent
  Key F1   A  SM  -
  Key F11  A  SM  -

It will not give core dump for you (otherwise you would not be able to
use fvwm-themes without crashes), but it gives on my second machine, where

% xmodmap -pk | grep F11
     67         0xffbe (F1)     0xffc8 (F11)
     95         0xffc8 (F11)

+++ Allocing key_name=F11, Action=Module FvwmIdent, 65535, 9, keysym=65480
+++ Allocing key_name=F11, Action=Module FvwmIdent, 65535, 9, keysym=65480
*** Matching keycode=67, context=65535, modifiers=9
@@@ Removing (after MatchBindingExactly) key F1, A, SM
--- Freeing  key_name=F11, Action=Module FvwmIdent, 65535, 9
*** Matching keycode=95, context=65535, modifiers=9
@@@ Removing (after MatchBindingExactly) key F11, A, SM
--- Freeing  key_name=F11, Action=Module FvwmIdent, 65535, 9

The last debug line originally contained a garbage, because this Action
was freed twice in FreeBindingStruct(). This is a bug. Freeing Action,
Action2 and Stroke_Seq in FreeBindingStruct() is against AddBinding(),
where only key_name is allocated, but not Action, Action2 and Stroke_Seq.

Just commenting out free() calls in FreeBindingStruct() is not a good fix,
although it fixes this core dump. I think Dominik can do a better fix.

Regards,
Mikhael.