Subject: Fvwm freezing

From: [email-masked]
Date: Wed, 9 Feb 2000 18:04:10 -0700 (MST)

Configuration Information [Automatically generated, do not change]:
uname output: Linux guyver 2.2.14 #2 Sun Feb 6 08:31:30 MST 2000 i586 unknown
Compiler: gcc
Compilation CFLAGS: -g -O2
prefix: /usr/X11R6
sysconfdir: /usr/X11R6/etc
libexecdir: /usr/X11R6/libexec

FVWM Version: 2.3.14
FVWM_CONFIGDIR: unset
FVWM_MODULEDIR: unset
FVWM_USERHOME: unset

Description:
	I just upgraded to the latest cvs this afternoon.  Restarted and no 
	problems for a few hours, then for some reason it stopped updating the
	screen.  So I had to kill it from console.  Restart and open a menu
	to startup rxvt boom same thing.  alt-ctrl-backspace out of X, startup
	again same thing.  alt-ctrl-backspace, ps ax shows two fvwm2 now running
	the modules defunct and two defunct rxvt.  fvwm2 had to be kill -9'd to
	die at which point the modules and rxvt's died also.  Never changed a 
	single letter in my rc, even tried without one to check.  Even more
	odd was at one point while frozen I had gqmpeg playing and I could
	even change the song just didn't update the display as to that fact.
	It wasn't a totally clean make but I can't see that being the problem.
	I shall try that now.
--
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: Jason Kibblewhite <[email-masked]>
Date: Wed, 9 Feb 2000 18:45:04 -0700

Subject: Fvwm freezing
	Date: Wed, Feb 09, 2000 at 06:04:10PM -0700

Time to reply!

> 	It wasn't a totally clean make but I can't see that being the problem.

Update:  Well I did a full clean make of fvwm2, still no change but I did
		 more testing.  I can exit using the menus or alt-ctrl-backspace
		 before I use a menu item and it works ok.  But any app doesn't
		 seem to come up.  Flipped over to the console and fired up rxvt
		 and it wouldn't display.  Any module in my rc file start up
		 however, so I added rxvt to initfunc and that didn't work.
--
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: Dominik Vogt <[email-masked]>
Date: Thu, 10 Feb 2000 05:48:00 +0100

> 		 however, so I added rxvt to initfunc and that didn't work.

Can you send it a SIGABORT when it hangs and see what's
happening?  Or even better: start a second X server and
attach a debugger from there.

Bye

Dominik ^_^

--
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
The adjuration to be "normal" seems shockingly repellent to me; I see neither
hope nor comfort in sinking to that low level.  I think it is ignorance that
makes people think of abnormality only with horror and allows them to remain
undismayed at the proximity of "normal" to average and mediocre.  For surely
anyone who achieves anything is, essentially, abnormal.
                -- Dr. Karl Menninger, "The Human Mind", 1930

---

From: Jason Kibblewhite <[email-masked]>
Date: Wed, 9 Feb 2000 22:32:04 -0700

Subject: Re: Fvwm freezing
	Date: Thu, Feb 10, 2000 at 05:48:00AM +0100

Time to reply!

> attach a debugger from there.

Well I sent it a killall -ABRT fvwm2 and it exited right away, but no error 
message of any kind.  Thinking that the two modules that do start up have
geometry settings I did test this and it works rxvt -geometry +0+0.  Not a
problem, I can even move it around and so on.  So I made a very minimal rc
Mouse 1 A A Popup Menu
Style * RandomPlacement
AddToMenu Menu rxvt exec rxvt

No go, so I did ActivePlacement also no work.  But naturally an 
exec rxvt -geometry +0+0 does.

gdb output follows

Program received signal SIGABRT, Aborted.
SmartPlacement (t=0x80a1f30, width=593, height=370, x=0xbffff660,
    y=0xbffff664, pdeltax=0, pdeltay=0) at placement.c:175
175     placement.c: No such file or directory.

This is ofcourse after I send it a ABRT, I get nothing until I do.

---

From: Dominik Vogt <[email-masked]>
Date: Thu, 10 Feb 2000 10:35:17 +0100

On Wed, Feb 09, 2000 at 10:32:04PM -0700, [email-masked] wrote:
> message of any kind.
> Thinking that the two modules that do start up have
  ^^^^^^^^^^^^^^^^^^^

It seems to loop forever in the SmartPlacement() function.
Can you place a fprintf in the inner while loop in
SmartPlacement() that prints out test_window, text_x, test_y, t
and loc_ok to identify why and in which loop it hangs?

  fprintf(stderr,"tw=0x%x, t=0x%x, tx=%d, ty=%d, lo=%d, (int)test_window, (int)t, test_x, test_y, loc_ok);

Bye

Dominik ^_^

-- 
Dominik Vogt, Agilent Technologies, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/464-4596, fax: 07031/464-3883, [email-masked]
--
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: Jason Kibblewhite <[email-masked]>
Date: Thu, 10 Feb 2000 04:04:07 -0700

Subject: Re: Fvwm freezing
	Date: Thu, Feb 10, 2000 at 10:35:17AM +0100
> > 175     placement.c: No such file or directory.

Gosh I hope I placed this in the correct place and it gives the output that
you need.  But I don't know where it starts so I'll just paste a few lines.

 test_x, test_y, loc_oktw=0x4005d28b, t=0x804a2ab, tx=-1073744312, ty=135049560, lo=-1073744308, (int)test_window,(int)t, test_x, test_y, loc_oktw=0x4005d28b, t=0x804a2ab, tx=-1073744312, ty=135049560, lo=-1073744308, (int)test_window,(int)t, test_x, test_y, loc_ok
 
I placed it at line 126 just after the third while, and before the 
if (t == test_window), oh and you missed a ", good thing vim has syntax 
highlighting or I'd never have seen that. :)

---

From: Tim Phipps <[email-masked]>
Date: Thu, 10 Feb 2000 11:18:59 +0000

>  test_x, test_y, loc_oktw=0x4005d28b, t=0x804a2ab, tx=-1073744312, ty=135049560, lo=-1073744308, (int)test_window,(int)t, test_x, test_y, loc_oktw=0x4005d28b, t=0x804a2ab, tx=-1073744312, ty=135049…

This looks like garbage off the stack. The missing qoute is probably the
cause. Try replacing the fprintf line with this:

fprintf(stderr,"tw=0x%x, t=0x%x, tx=%d, ty=%d, lo=%d\n",
(int)test_window, (int)t, test_x, test_y, loc_ok);

Cheers,
Tim.

---

From: Mikhael Goikhman <[email-masked]>
Date: Thu, 10 Feb 2000 13:20:16 +0200

> It seems to loop forever in the SmartPlacement() function.

The bug is in the inner while as you pointed:

	if (t == test_window)
	  continue;

Replacing 'continue' with 'break' seems to fix the problem for me.
But then this condition could be placed in the while.

Regards,
Mikhael.

---

From: Dominik Vogt <[email-masked]>
Date: Thu, 10 Feb 2000 12:23:42 +0100

On Thu, Feb 10, 2000 at 04:04:07AM -0700, [email-masked] wrote:
> Gosh I hope I placed this in the correct place

Yup.

> and it gives the output that
> you need.

No, unfortunately not.  It looks if the printf didn't work properly.
Try replacing the whole SmartPlacement() function with this version:

----------------------- snip -----------------------
static int SmartPlacement(FvwmWindow *t,
			  int width,
			  int height,
			  int *x,
			  int *y,
			  int pdeltax,
			  int pdeltay)
{
  int PageBottom    =  Scr.MyDisplayHeight - pdeltay;
  int PageRight     =  Scr.MyDisplayWidth - pdeltax;
  int PageTop       =  0 - pdeltay;
  int PageLeft      =  0 - pdeltax;
  int rc            =  True;
/**/
  int temp_h,temp_w;
  int test_x = 0,test_y = 0;
  int loc_ok = False, tw,tx,ty,th;
  FvwmWindow *test_window;
  int stickyx, stickyy;

int c1 = 0;
int c2 = 0;
int c3 = 0;

/*  RBW - 11/02/1998  */
test_x = PageLeft;
test_y = PageTop;
/**/

  temp_h = height;
  temp_w = width;

fprintf(stderr,"\nsp: entered, PL=%d, PT=%d\n", PageLeft, PageTop);
/*  RBW - 11/02/1998  */
  while (test_y + temp_h < PageBottom && !loc_ok)
  {
c1++;
    test_x = PageLeft;
    while (test_x + temp_w < PageRight && !loc_ok)
    {
c2++;
      loc_ok = True;
      test_window = Scr.FvwmRoot.next;
      while (test_window != NULL && loc_ok)
      {
fprintf(stderr,"%d/%d/%d: tw=0x%x, t=0x%x, tx=%d, ty=%d, lo=%d\n", c1, c2, c3, (int)test_window, (int)t, test_x, test_y, loc_ok);
c3++;
	if (t == test_window)
	  continue;
        /*  RBW - account for sticky windows...  */
        if (test_window->Desk == t->Desk || IS_STICKY(test_window))
        {
          if (IS_STICKY(test_window))
	  {
	    stickyx = pdeltax;
	    stickyy = pdeltay;
	  }
          else
	  {
	    stickyx = 0;
	    stickyy = 0;
	  }
#ifndef NO_STUBBORN_PLACEMENT
          if((IS_ICONIFIED(test_window))&&!(IS_ICON_UNMAPPED(test_window))&&
             (test_window->icon_w)&&(test_window != t))
          {
            tw=test_window->icon_p_width;
            th=test_window->icon_p_height+
              test_window->icon_g.height;
            tx = test_window->icon_g.x - stickyx;
            ty = test_window->icon_g.y - stickyy;

            if((tx<(test_x+width))&&((tx + tw) > test_x)&&
               (ty<(test_y+height))&&((ty + th)>test_y))
            {
              loc_ok = False;
              test_x = tx + tw;
            }
          }
#endif /* !NO_STUBBORN_PLACEMENT */
          if(!(IS_ICONIFIED(test_window))&&(test_window != t))
          {
            tw = test_window->frame_g.width;
            th = test_window->frame_g.height;
            tx = test_window->frame_g.x - stickyx;
            ty = test_window->frame_g.y - stickyy;
            if((tx <= (test_x+width))&&((tx + tw) >= test_x)&&
               (ty <= (test_y+height))&&((ty + th)>= test_y))
            {
              loc_ok = False;
              test_x = tx + tw;
            }
          }
        }
        test_window = test_window->next;
      }
      test_x +=1;
    }
    test_y +=1;
  }
  /*  RBW - 11/02/1998  */
  if(loc_ok == False)
  {
    rc  =  False;
    return rc;
  }
  *x = test_x;
  *y = test_y;
  return rc;
  /**/
}
----------------------- snip -----------------------

Bye

Dominik ^_^

---

From: Dominik Vogt <[email-masked]>
Date: Thu, 10 Feb 2000 12:30:14 +0100

> Replacing 'continue' with 'break' seems to fix the problem for me.

But that doesn't seem the right fix to me.  If we break out of
the loop, PlaceAgain will only consider some of the other
windows.  I guess it works with initial placement.  If the
loop is never left, then there must be a loop in the window
list (i.e. test_window will never be NULL), right?

Bye

Dominik ^_^

---

From: Jason Kibblewhite <[email-masked]>
Date: Thu, 10 Feb 2000 05:10:43 -0700

Subject: Re: Fvwm freezing
	Date: Thu, Feb 10, 2000 at 11:18:59AM +0000

Time to reply!

> > >   fprintf(stderr,"tw=0x%x, t=0x%x, tx=%d, ty=%d, lo=%d, (int)test_window, (int)t, test_x, test_y, loc_ok);
--blah--
> This looks like garbage off the stack. The missing quote is probably the

Ok Tim's code out-putted this, which of course does me nothing so here's to
hoping you people know what they mean because I sure don't.
tw=0x80cb0d0, t=0x80cb0d0, tx=0, ty=0, lo=1

Dominik's code out-putted a slightly more verbose
1/1/59130: tw=0x80cb188, t=0x80cb188, tx=0, ty=0, lo=1

While Mikhael's code change laced with Tim's addition out-putted
tw=0x80cb620, t=0x80cb620, tx=0, ty=0, lo=1
tw=0x80cb620, t=0x80cb620, tx=0, ty=0, lo=1
tw=0x80cb620, t=0x80cb620, tx=0, ty=0, lo=1

Again they don't mean anything to me.  But Mikhael's change did fix another
bug I was having with GrabFocus in which it wasn't. :)
--
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: Dominik Vogt <[email-masked]>
Date: Thu, 10 Feb 2000 13:52:35 +0100

On Thu, Feb 10, 2000 at 01:41:52PM +0200, Mikhael Goikhman wrote:
> On 10 Feb 2000 12:30:14 +0100, Dominik Vogt wrote:
> > 
> I just pointed to a C bug. The following while will never quit:
> 
> t = test_window = 1;
> while (test_window) {
> 	if (t == test_window)
> 		continue;
> }
> 
> I suggested to commit s/continue/break/ as an immediate fix to a freeze.
> I am not sure about how to fix PlaceAgain though.

Er, um, yes, I guess you're right.  I'm used to for-loops.
Will be fixed in a minute.

Bye

Dominik ^_^

---

From: Dominik Vogt <[email-masked]>
Date: Thu, 10 Feb 2000 13:57:19 +0100

> tw=0x80cb620, t=0x80cb620, tx=0, ty=0, lo=1

Now that Mikhael explained his fix again (so that idiots like
me can understand it), it's pretty clear why it hung.  I've
committed a fix.

> But Mikhael's change did fix another
                                  ^^^^^^^^^^^^^^^^^^^

Um, in which what wasn't?  What is the bug you hint at?

Bye

Dominik ^_^

---

From: Jason Kibblewhite <[email-masked]>
Date: Thu, 10 Feb 2000 06:21:16 -0700

[snip]

> Um, in which what wasn't?  What is the bug you hint at?

Well I had made a few sweeping changes in my config as such I didn't notice
until yesterday that the Style * GrabFocus I use wasn't grabbing focus.  
I didn't have time to play with it yesterday, but when I started it after I 
changed the code I noticed it did grab focus.  In all honesty it could have
been somewhere in the cvs I did yesterday, since the first window I opened
after a restart froze fvwm I wouldn't have noticed.
--
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: Jason Kibblewhite <[email-masked]>
Date: Thu, 10 Feb 2000 06:53:12 -0700

> after a restart froze fvwm I wouldn't have noticed.

Oops, seems it was just a fubar in my config and that line was overwritten
but Style * GrabFocusOff I had laying about somewhere else.  Please disregard
--
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]