Subject: Re: Notification: incoming/212

From: [email-masked] (Paul D. Smith)
Date: 01 Mar 1999 10:13:44 -0500

%% [email-masked] writes:

  f> [Sorry for creating a new bug... I tried updating my previous bug
  f> report; but the system won't let me do this as 'guest' and I didn't
  f> find a way to login (no account anyway...).]

You can't login to the bug database unless you're a maintainer.
Jitterbug is a minimalist system, to be sure :).  You're not allowed to
create your own accounts or anything.

Anyway, this is one way to go (create a new bug) but another would be to
just send the new information to the fvwm-workers list, referencing the
original bug number, and someone here'll add the note to the bug.

Thanks for continuing to look into this!

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[email-masked]>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
--
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: Pierre Fortin <[email-masked]>
Date: Wed, 03 Mar 1999 16:13:21 +0000

Just had another occurence...  this time, FvwmTaskBar went into a loop
for a few minutes, then crashed before I could look into it...

(gdb) where
#0  0x40076a61 in XTextWidth ()
#1  0x804ccd2 in ButtonDraw (button=0x8057978, x=687, y=1, w=36, h=22)
    at ButtonArray.c:160
#2  0x804d190 in DrawButtonArray (array=0x8051870, all=1) at
ButtonArray.c:403
#3  0x804a59f in RedrawWindow (force=1) at FvwmTaskBar.c:536
#4  0x804a3e7 in ProcessMessage (type=1024, body=0x8057ad8)
    at FvwmTaskBar.c:459
#5  0x8049f3d in ReadFvwmPipe () at FvwmTaskBar.c:309
#6  0x8049f06 in EndLessLoop () at FvwmTaskBar.c:290
#7  0x8049db9 in main (argc=6, argv=0xbffffc64) at FvwmTaskBar.c:231

Not being familiar with gdb and what might be useful, I'm all ears for a
quick gdb sequence to use when this occurs...

Right now, I am running without a taskbar; if I try to start one, it
immediately becomes a cpu hog...  so, I'll have to wait for a convenient
break to restart the X server...

Cheers,
Pierre

---

From: [email-masked] (Paul D. Smith)
Date: 04 Mar 1999 12:36:40 -0500

%% Pierre Fortin <[email-masked]> writes:

  pf> Just had another occurence...  this time, FvwmTaskBar went into a loop
  pf> for a few minutes, then crashed before I could look into it...

  pf> Not being familiar with gdb and what might be useful, I'm all ears for a
  pf> quick gdb sequence to use when this occurs...

What you typically want to do is run GDB and attach to the running app.
You can do this with:

  $ gdb /usr/local/libexec/fvwm/2.2/FvwmTaskBar <PID>

Once you attach, you can try next-ing or step-ping through, and see if
you can tell where it's looping; if you can describe the loop maybe we
can look more closely.

Another thing that can be useful is, esp. if you know it's going to
immediately go south, you can use truss or strace or whatever your
system supports and log the output; it might be possible to see the loop
from that, too.

---

From: Pierre Fortin <[email-masked]>
Date: Fri, 05 Mar 1999 18:30:42 +0000

Hi Paul,

Well... this time I was so busy editing and running jobs that I didn't
even notice the taskbar crashing...  so I didn't get to gdb the
process...

Before the problem, I tried to recreate the steps I originally thought
might be contributing to the crash with no luck.  Then I thought the
problem might be related to incoming mail which causes part of the mail
icon to appear white until netscape gets it (my mail POP is local with
NS set to check every 1 minute), so I started an strace... Starting long
before the segv; it's about 2MB...  here are the last lines in the trace
(let me know if you need/want more):

select(1024, [3 4], NULL, NULL, {0, 0}) = 1 (in [4], left {0, 0})
read(4, "\377\377\377\377 \0\0\0\34\0\0\0"..., 16) = 16
read(4, "\r\0@\0038\2\200\0\330\265\n\10\2"..., 96) = 96
time([920655759])                       = 920655759
write(3, "=\0\4\0\3\0@\1t\3\0\0\204\0\26\0"..., 136) = 136
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {0, 0}) = 1 (in [4], left {0, 0})
read(4, "\377\377\377\377 \0\0\0\34\0\0\0"..., 16) = 16
read(4, "\r\0\0\3)\2\200\0\300\251\n\10\2"..., 96) = 96
time([920655759])                       = 920655759
write(3, "=\0\4\0\3\0@\1t\3\0\0\204\0\26\0"..., 136) = 136
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {0, 0}) = 1 (in [4], left {0, 0})
read(4, "\377\377\377\377 \0\0\0\34\0\0\0"..., 16) = 16
read(4, "\r\0\0\2*\1\200\0\0\211\n\10\0\0"..., 96) = 96
time([920655759])                       = 920655759
write(3, "=\0\4\0\3\0@\1t\3\0\0\204\0\26\0"..., 136) = 136
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {0, 0}) = 1 (in [4], left {0, 0})
read(4, "\377\377\377\377 \0\0\0\34\0\0\0"..., 16) = 16
read(4, "\32\0\200\3G\2\200\0x\305\n\10f\1"..., 96) = 96
time([920655759])                       = 920655759
write(3, "=\0\4\0\3\0@\1t\3\0\0\204\0\26\0"..., 136) = 136
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {0, 0}) = 0 (Timeout)
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {30, 0}) = 1 (in [4], left {29, 990000})
read(4, "\377\377\377\377 \0\0\0\34\0\0\0"..., 16) = 16
read(4, "\32\0\300\0055\3\200\0\30\361\n\10"..., 96) = 96
time([920655759])                       = 920655759
write(3, "=\0\4\0\3\0@\1t\3\0\0\204\0\26\0"..., 136) = 136
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {0, 0}) = 1 (in [4], left {0, 0})
read(4, "\377\377\377\377 \0\0\0\34\0\0\0"..., 16) = 16
read(4, "\32\0\200\3G\2\200\0x\305\n\10f\1"..., 96) = 96
time([920655759])                       = 920655759
write(3, "=\0\4\0\3\0@\1t\3\0\0\204\0\26\0"..., 136) = 136
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {0, 0}) = 0 (Timeout)
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {30, 0}) = 1 (in [4], left {24, 130000})
read(4, "\377\377\377\377 \0\0\0\34\0\0\0"..., 16) = 16
read(4, "\r\0\0\6S\3\200\0\330\376\n\10\1"..., 96) = 96
time([920655765])                       = 920655765
write(3, "=\0\4\0\3\0@\1t\3\0\0\204\0\26\0"..., 136) = 136
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {0, 0}) = 1 (in [4], left {0, 0})
read(4, "\377\377\377\377\4\0\0\0\34\0\0\0"..., 16) = 16
read(4, "\r\0\0\6S\3\200\0\330\376\n\10\1"..., 96) = 96
time([920655765])                       = 920655765
write(3, "=\0\4\0\3\0@\1t\3\0\0\204\0\26\0"..., 136) = 136
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {0, 0}) = 1 (in [4], left {0, 0})
read(4, "\377\377\377\377\0\4\0\0\t\0\0\0"..., 16) = 16
read(4, "\r\0\0\6S\3\200\0\330\376\n\10nx"..., 20) = 20
time([920655765])                       = 920655765
write(3, "=\0\4\0\3\0@\1\0\0\0\0\370\3\26\0"..., 2048) = 2048
time([920655765])                       = 920655765
write(3, "B\0\7\0\3\0@\1\6\0@\1\316\1\0\0\361"..., 2048) = 2048
write(3, "B\0\5\0\3\0@\1\5\0@\1t\3\0\0t\3\24"..., 128) = 128
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {0, 0}) = 1 (in [4], left {0, 0})
read(4, "\377\377\377\377\0\10\0\0\t\0\0\0"..., 16) = 16
read(4, "\r\0\0\6S\3\200\0\330\376\n\10nx"..., 20) = 20
time([920655765])                       = 920655765
write(3, "=\0\4\0\3\0@\1t\3\0\0\204\0\26\0"..., 136) = 136
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {0, 0}) = 1 (in [4], left {0, 0})
read(4, "\377\377\377\377\0 \0\0\t\0\0\0$"..., 16) = 16
read(4, "\r\0\0\6S\3\200\0\330\376\n\10nx"..., 20) = 20
time([920655765])                       = 920655765
write(3, "=\0\4\0\3\0@\1t\3\0\0\204\0\26\0"..., 136) = 136
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {0, 0}) = 1 (in [4], left {0, 0})
read(4, "\377\377\377\377\0\0\200\0\20\0\0"..., 16) = 16
read(4, "\r\0\0\6S\3\200\0\330\376\n\10\20"..., 48) = 48
time([920655765])                       = 920655765
write(3, "=\0\4\0\3\0@\0016\3\0\0%\0\26\0B"..., 340) = 340
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {0, 0}) = 1 (in [4], left {0, 0})
read(4, "\377\377\377\377@\0\0\0\t\0\0\0A"..., 16) = 16
read(4, "\r\0\0\6S\3\200\0\330\376\n\10\377"..., 20) = 20
time([920655765])                       = 920655765
write(3, "=\0\4\0\3\0@\0016\3\0\0%\0\26\0F"..., 384) = 384
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {0, 0}) = 0 (Timeout)
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {30, 0}) = 0 (Timeout)
time([920655795])                       = 920655795
open("/var/spool/mail/pfortin", O_RDONLY) = 5
fstat(5, {st_mode=0, st_size=0, ...})   = 0
close(5)                                = 0
write(3, "=\0\4\0\3\0@\1t\3\0\0\204\0\26\0"..., 136) = 136
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {30, 0}) = 1 (in [4], left {18, 700000})
read(4, "\377\377\377\377 \0\0\0\34\0\0\0"..., 16) = 16
read(4, "\32\0@\6b\3\200\0\330\0\v\10\207"..., 96) = 96
time([920655806])                       = 920655806
open("/var/spool/mail/pfortin", O_RDONLY) = 5
fstat(5, {st_mode=0, st_size=0, ...})   = 0
close(5)                                = 0
write(3, "=\0\4\0\3\0@\1t\3\0\0\204\0\26\0"..., 136) = 136
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {0, 0}) = 1 (in [4], left {0, 0})
read(4, "\377\377\377\377\4\0\0\0\34\0\0\0"..., 16) = 16
read(4, "\32\0@\6b\3\200\0\330\0\v\10\207"..., 96) = 96
time([920655806])                       = 920655806
write(3, "=\0\4\0\3\0@\1t\3\0\0\204\0\26\0"..., 136) = 136
ioctl(3, FIONREAD, [0])                 = 0
select(1024, [3 4], NULL, NULL, {0, 0}) = 1 (in [4], left {0, 0})
read(4, "\377\377\377\377\0\4\0\0\r\0\0\0"..., 16) = 16
read(4, "\32\0@\6b\3\200\0\330\0\v\10emac"..., 36) = 36
time([920655806])                       = 920655806
write(3, "=\0\4\0\3\0@\1\0\0\0\0\370\3\26\0"..., 2036) = 2036
--- SIGSEGV (Segmentation fault) ---

Here is the gdb stack:
(gdb) where
#0  0x40076a61 in XTextWidth ()
#1  0x804ccd2 in ButtonDraw (button=0x8057cf0, x=785, y=1, w=35, h=22)
at ButtonArray.c:160
#2  0x804d190 in DrawButtonArray (array=0x8051870, all=1) at
ButtonArray.c:403
#3  0x804a59f in RedrawWindow (force=1) at FvwmTaskBar.c:536
#4  0x804a3e7 in ProcessMessage (type=1024, body=0x80578a0) at
FvwmTaskBar.c:459
#5  0x8049f3d in ReadFvwmPipe () at FvwmTaskBar.c:309
#6  0x8049f06 in EndLessLoop () at FvwmTaskBar.c:290
#7  0x8049db9 in main (argc=6, argv=0xbffffc64) at FvwmTaskBar.c:231

HTH,
Pierre

---

From: Pierre Fortin <[email-masked]>
Date: Thu, 11 Mar 1999 21:18:49 +0000

Hi Paul,

Just now, I noticed the taskbar looping again, and I managed to get the
following gdb info...  I'm not very familiar with gdb, so I just grabbed
what looked reasonable from "info gdb"...

HTH,
Pierre

Attaching to program `/usr/local/libexec/fvwm/2.2//FvwmTaskBar', Pid 649
Reading symbols from /usr/X11R6/lib/libXpm.so.4...done.
Reading symbols from /usr/X11R6/lib/libSM.so.6...done.
Reading symbols from /usr/X11R6/lib/libICE.so.6...done.
Reading symbols from /usr/X11R6/lib/libXext.so.6...done.
Reading symbols from /usr/X11R6/lib/libX11.so.6...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
Reading symbols from /lib/libnss_files.so.1...done.
0x804cce7 in ButtonDraw (button=0x8057120, x=747, y=1, w=35, h=22) at
ButtonArray.c:160
160         while ((x3p = XTextWidth(font, button->title, search_len) +
newx) > w-w3p-3)
(gdb) whe
#0  0x804cce7 in ButtonDraw (button=0x8057120, x=747, y=1, w=35, h=22)
at ButtonArray.c:160
#1  0x804d190 in DrawButtonArray (array=0x8051870, all=1) at
ButtonArray.c:403
#2  0x804a59f in RedrawWindow (force=1) at FvwmTaskBar.c:536
#3  0x804a3e7 in ProcessMessage (type=1024, body=0x8057a60) at
FvwmTaskBar.c:459
#4  0x8049f3d in ReadFvwmPipe () at FvwmTaskBar.c:309
#5  0x8049f06 in EndLessLoop () at FvwmTaskBar.c:290
#6  0x8049db9 in main (argc=6, argv=0xbffffc64) at FvwmTaskBar.c:231
(gdb) step
161           search_len--;
(gdb) 
160         while ((x3p = XTextWidth(font, button->title, search_len) +
newx) > w-w3p-3)
(gdb) 
161           search_len--;
(gdb) 
160         while ((x3p = XTextWidth(font, button->title, search_len) +
newx) > w-w3p-3)
(gdb) 
161           search_len--;
(gdb) 
160         while ((x3p = XTextWidth(font, button->title, search_len) +
newx) > w-w3p-3)
(gdb) 
161           search_len--;
(gdb) 
160         while ((x3p = XTextWidth(font, button->title, search_len) +
newx) > w-w3p-3)
(gdb) print search_len
$1 = -576987128
(gdb) step
161           search_len--;
(gdb) 
160         while ((x3p = XTextWidth(font, button->title, search_len) +
newx) > w-w3p-3)
(gdb) print search_len
$2 = -576987129
(gdb) print button->title
$3 = 0x80578c8 "Netscape: Python 1.5 and Beyond"
(gdb) print newx
$4 = 22
(gdb) print w
$5 = 35
(gdb) print w3p
$6 = 12
(gdb) frame
#0  ButtonDraw (button=0x8057120, x=747, y=1, w=35, h=22) at
ButtonArray.c:160
160         while ((x3p = XTextWidth(font, button->title, search_len) +
newx) > w-w3p-3)
(gdb) info frame
Stack level 0, frame at 0xbffffae4:
 eip = 0x804ccc8 in ButtonDraw (ButtonArray.c:160); saved eip 0x804d190
 called by frame at 0xbffffb14
 source language c.
 Arglist at 0xbffffae4, args: button=0x8057120, x=747, y=1, w=35, h=22
 Locals at 0xbffffae4, Previous frame's sp is 0x0
 Saved registers:
  ebx at 0xbffffa78, ebp at 0xbffffae4, esi at 0xbffffa7c, edi at
0xbffffa80, eip at 0xbffffae8
(gdb) info catch
No catches.
(gdb) info locals
button = (Button *) 0x8057120
t3p = 0x804fb92 "..."
state = -576987129
x3p = 22
newx = 22
search_len = -576987129
font = (XFontStruct *) 0x8053968
gcv = {function = 16, plane_mask = 1075296528, foreground = 884,
background = 134552672, line_width = 134554224, line_style = 20971533,
cap_style = 134554312, 
  join_style = 134554330, fill_style = 134551460, fill_rule = 18,
arc_mode = 20, tile = 134552672, stipple = 1074134351, ts_x_origin =
1075296528, 
  ts_y_origin = 884, font = 20971522, subwindow_mode = -1073743104,
graphics_exposures = 134537675, clip_x_origin = 750, clip_y_origin = 4,
clip_mask = 0, 
  dash_offset = 134571512, dashes = 0 '\000'}
(gdb) info args
button = (Button *) 0x8057120
x = 747
y = 1
w = 35
h = 22
(gdb)
--
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: [email-masked] (Paul D. Smith)
Date: 11 Mar 1999 16:42:28 -0500

pf> Just now, I noticed the taskbar looping again, and I managed to
  pf> get the following gdb info...  I'm not very familiar with gdb, so
  pf> I just grabbed what looked reasonable from "info gdb"...

  pf> 160         while ((x3p = XTextWidth(font, button->title, search_len) + newx) > w-w3p-3)
  pf> 161           search_len--;

  pf> (gdb) print search_len
  pf> $1 = -576987128

Oh dear!  Yes, that loop will _definitely_ take a while to finish :-/.

Search_len is set to the strlen of the button title:

  pf> (gdb) print button->title
  pf> $3 = 0x80578c8 "Netscape: Python 1.5 and Beyond"

so it started out with a reasonable value.  This loop is trying to find
how much of the title string it can fit onto the button, along with the
"..." extension, if it won't all fit.

Can you reproduce this every time you visit, say, a Netscape site with a
very long title, so that it won't fit on the button?  You also need to
have lots of apps open, so your buttons on the task bar are much
smaller.  Or does it only happen for certain long titles?  If you visit
that same site again in Netscape, does it happen again?

What font are you using for FvwmTaskBar, in particular the button
titles?

I wonder if you're not getting into a situation where the button is so
small that not even the "..." will fit?  Or that's all that will fit?

Anyway, try replacing the loop with this:

  if (XTextWidth(font, button->title, search_len) > w-newx-3) {

    while (search_len > 0
           && ((x3p = XTextWidth(font, button->title, search_len) + newx)
               > w-w3p-3))
      search_len--;
    XDrawString(dpy, win, graph, x + x3p, y+ButtonFont->ascent+4, t3p, 3);

    button->truncate = True;
  } else {
    button->truncate = False;
  }

  if (search_len)
    XDrawString(dpy, win, graph,
                x+newx, y+font->ascent+4,
                button->title, search_len);

I suppose if you had _SO_ many buttons that even the "..." wouldn't fit,
this still prints them all so you might see some text walking off the
edge of the button or something.  Oh well.

I think all this code needs to be reworked a bit, but the above should
help with the infinite looping.

---

From: Pierre Fortin <[email-masked]>
Date: Thu, 11 Mar 1999 22:12:44 +0000

> Oh dear!  Yes, that loop will _definitely_ take a while to finish :-/.

Any time I've let it finish (usually by not noticing it until it's too
late), it crashes...

> very long title, so that it won't fit on the button?  You also need to

Not usually, only after I have lots of buttons on the bar...  Funny, my
very first suspicion was that the bubble was too long; but from what I
could see, I thought it was related to the number of buttons that got
overlaid by the bubble.  Now I see that it more likely what you suspect
here...  

> that same site again in Netscape, does it happen again?

The problem occurs when there are *lots* of buttons on the task bar.  In
this case, when I spotted the problem, the buttons were small as I'd
expect, but they only went about half way across...  

I may have to restart X since the bar would always get back into a loop
unless I restarted it...  Hmmm...  now, I'm puzzled...  I thought the
buttons were displayed for EITHER the dt0 or dt1, not both...  On
previous loops, I noticed that both dt0 and dt1 buttons were on the
bar...  this time, only half the buttons (and just wide enough) to cover
half the bar...  I'm thinking there may be another related bug here...

> What font are you using for FvwmTaskBar, in particular the button

Whatever the default is; I've never changed it...  not sure where to
check...  :)

> small that not even the "..." will fit?  Or that's all that will fit?

Absolutely...  sometimes I wonder if even the red hat will fit...

> Anyway, try replacing the loop with this:

Will do.

> edge of the button or something.  Oh well.

no biggy if that's the worst effect...

> help with the infinite looping.

I'll try it and get back to you...

Thanks,
Pierre

---

From: Pierre Fortin <[email-masked]>
Date: Fri, 12 Mar 1999 00:28:15 +0000

Hi Paul,

> Anyway, try replacing the loop with this:

Done.

> edge of the button or something.  Oh well.

Right now, I have 26 buttons; definitely no room for '...'  Moving the
mouse over the vdt causes bubbles to overlap some buttons which then get
redrawn.  The last button even overlaps the day, then gets cropped
depending on which way the mouse moves... :>

At least it's hanging in right now..

> help with the infinite looping.

Yup...  sure does... much appreciated!

Thanks,
Pierre

---

From: [email-masked] (Paul D. Smith)
Date: 12 Mar 1999 00:51:49 -0500

pf> The problem occurs when there are *lots* of buttons on the task bar.  In
  pf> this case, when I spotted the problem, the buttons were small as I'd
  pf> expect, but they only went about half way across...  

Probably that's just because FvwmTaskBar hung up about halfway through
redrawing the buttons, so you don't see them all.

Well, I'll commit a fix similar to this one--I don't know what the
maintenance status of FvwmTaskBar is going forward but at least we'll
keep it from hanging, even if it might look messy for lots 'n lots of
buttons.

Thanks for your help in tracking it down!

---

From: Tim Phipps <[email-masked]>
Date: Fri, 12 Mar 1999 07:42:34 +0000

> keep it from hanging, even if it might look messy for lots 'n lots of

It would be great if you made a library function, there are lots of
buttons in fvwm and the modules that don't do truncation very well.
Something like

int TrimRight(Display, Font, char* string, int width);

that returns the number of chars to print before the "..."

Cheers,
Tim.