« Return to Thread: Bug Report: Locking X11 with FOX

Bug Report: Locking X11 with FOX

by Hal Brand :: Rate this Message:

Reply to Author | View in Thread

Both FOX V1.6.36 and V1.7.19 can lock-up X11 if the application
temporarily starves the FOX event loop.

We have applications that can have lots of work to do soon after
starting depending on many factors. We have observed X11 lock-ups (X
Server grabbed, but FOX not processing the events properly) on numerous
occasions. This is a problem with our application in the field as users
often start clicking as soon as the window appears.

This problem can be reproduced using at least one FOX test program with
simple mods to simulate the situation. (It will probably occur with any
FOX test application that involves pop-up menus (and maybe other pop-up,
server-grabbing widgets).) In this case, I have used a FXChore that
consumes a lot of CPU, then continually halves the CPU used until it
finally doesn't schedule itself any more.

Reproduction of the problem is simple. Build FOX, cd  into the tests/
directory and patch using the supplied context differences. (Note: these
differences were generated from V1.6.36, but can be applied to V1.7.19.)
Now, "make" and run the imageviewer. As soon as the window appears, left
mouse click on File, (don't wait for any action) then left mouse click
on Edit. With proper timing, the cursor will change from left pointing
to right pointing and your X session will be locked. Note that no amount
of mouse clicking anywhere will get results. Most window managers will
allow a keyboard escape. The one I use is CTRL-ALT-d which shrinks all
windows and releases the server grab.

It may be necessary to adjust the loop counter initial value (static int
c = 70000000;) for the machine running the test. The value chosen pretty
reliably locks my machine which is (from /proc/cpuinfo) "Intel(R)
Core(TM)2 Extreme CPU X9650  @ 3.00GHz".

I can provide a FOX -tracelevel <v> file if desired. The level 500 file
is 149KBytes so I guessed it best to send it by request.

--
Hal Brand



*** imageviewer.cpp.orig 2009-03-12 22:45:10.000000000 -0700
--- imageviewer.cpp 2009-06-08 15:48:02.000000000 -0700
***************
*** 74,79 ****
--- 74,81 ----
    long onCmdScale(FXObject*,FXSelector,void*);
    long onCmdCrop(FXObject*,FXSelector,void*);
    long onUpdImage(FXObject*,FXSelector,void*);
+   long onChore(FXObject*,FXSelector,void*);
+
  public:
    enum{
      ID_ABOUT=FXMainWindow::ID_LAST,
***************
*** 91,96 ****
--- 93,99 ----
      ID_MIRROR_BOTH,
      ID_SCALE,
      ID_CROP,
+     ID_CHORE,
      ID_LAST
      };
  public:
***************
*** 238,245 ****
--- 241,263 ----
    FXMAPFUNC(SEL_UPDATE,        ImageWindow::ID_MIRROR_BOTH,ImageWindow::onUpdImage),
    FXMAPFUNC(SEL_UPDATE,        ImageWindow::ID_SCALE,      ImageWindow::onUpdImage),
    FXMAPFUNC(SEL_UPDATE,        ImageWindow::ID_CROP,       ImageWindow::onUpdImage),
+   FXMAPFUNC(SEL_CHORE,ImageWindow::ID_CHORE,ImageWindow::onChore)
    };
 
+ long ImageWindow::onChore(FXObject*,FXSelector,void*)
+ {
+   static double d = 0.0;
+   static int c = 70000000;
+   FXTRACE((300,"ImageWindow::onChore In[%i]\n",c));
+   double sum = 0.0;
+   for (int i = 0; i < c; ++i)
+     sum += sin(double(i)/double(c));
+   d += sum;
+   c /= 2;
+   if (c > 1)
+     FXApp::instance()->addChore(this,ID_CHORE,0);
+   return 1;
+ }
 
  // Object implementation
  FXIMPLEMENT(ImageWindow,FXMainWindow,ImageWindowMap,ARRAYNUMBER(ImageWindowMap))
***************
*** 778,783 ****
--- 796,803 ----
    // Passed image file?
    if(argc>1) window->loadimage(argv[1]);
 
+   application.addChore(window,ImageWindow::ID_CHORE,0);
+
    // Run
    return application.run();
    }

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Foxgui-users mailing list
Foxgui-users@...
https://lists.sourceforge.net/lists/listinfo/foxgui-users

 « Return to Thread: Bug Report: Locking X11 with FOX