LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 08-24-2010, 11:32 PM   #1
sanushchacko
LQ Newbie
 
Registered: Aug 2010
Posts: 6

Rep: Reputation: 0
Xwindows Error Handling Failing in Linux


Hi All,
We have a 32bit Motif Gui application. Recently we ported the application from solaris(Version 5.10) to Linux(version 5.4). The issue we are facing is our application is crashing very frequently in Linux.

In our application the Default Error handler for Xlib is overridden. ie, for the X11 errors system will call our Local Error Handler.

Code to set the Local Error handler :-
XSetErrorHandler( LocalErrorHandler );
.....

static int LocalErrorHandler(
X11Display *display,
XErrorEvent *event)
{
....
}


This will work quite normal for some time. ie, when an Xlib error occurs, our LocalErrorHandler will be called and system will work as expected.
But at certain scenarios when an Xlib error occurs, the X11 is calling its own Error Handler. As you know the behavior of the X11 Default Error handler is to KILL the application. This is the reason for the crash of our application.

So here Xlib in Linux behaves differently for SAME Error.
The X error occurring in our application is "# X Error: "BadPixmap (invalid Pixmap parameter)". We can see that almost all the time when this error occur, the system is calling our Local Error handler. But at certain scenarios when this Xlib error occur, system calls Xlib Error handler and application crashes.

I would like to know why the Xlib is calling the Default Error Handler instead of our overridden LocalErrorHandler.

Linux Version -> release 5.4
Kernel version -> 2.6.18-164.el5

STACK TRACE of the CORE file (Calling X11 Error handler)
-------------------------
#0 0xffffe405 in __kernel_vsyscall ()
#1 0x00804df0 in raise () from /lib/libc.so.6
#2 0x00806701 in abort () from /lib/libc.so.6
#3 0x0083d28b in __libc_message () from /lib/libc.so.6
#4 0x00845595 in _int_free () from /lib/libc.so.6
#5 0x008459d9 in free () from /lib/libc.so.6
#6 0xf3a50996 in __1c2k6Fpv_v_ () from /data1/users/mcs/mcs_link/lib/libCrun.so.1
#7 0xf47a7245 in ~Gui (this=0xf47ce5b0)
at /data1/users/bldadmmcs/pvcs/qr_approved/mcs/src/mcs/gui/guixt.cc:1604
#8 0xf47a7c6f in __SLIP.FINAL__B ()
at /data1/users/bldadmmcs/pvcs/qr_approved/mcs/src/mcs/gui/guixt.cc:349
#9 0x00808059 in __cxa_finalize () from /lib/libc.so.6
#10 0xf47be1da in _fini () from /data1/users/mcs/mcs_link/lib/libgui.so
#11 0x007cc7ce in _dl_fini () from /lib/ld-linux.so.2
#12 0x00807da9 in exit () from /lib/libc.so.6
#13 0x00abdd1c in _XDefaultError () from /usr/lib/libX11.so.6
#14 0x00abde4a in _XError () from /usr/lib/libX11.so.6
#15 0x00abf914 in _XReply () from /usr/lib/libX11.so.6
#16 0x00aa0ebc in XGetSelectionOwner () from /usr/lib/libX11.so.6
#17 0xf3d9f034 in ?? () from /usr/lib/libXm.so.4
#18 0xf3d92f2b in ?? () from /usr/lib/libXm.so.4
#19 0x06917302 in ?? () from /usr/lib/libXt.so.6
#20 0x06916ce9 in ?? () from /usr/lib/libXt.so.6
#21 0x06916ca7 in ?? () from /usr/lib/libXt.so.6
#22 0x06916ca7 in ?? () from /usr/lib/libXt.so.6
#23 0x06916ca7 in ?? () from /usr/lib/libXt.so.6
#24 0x06916ca7 in ?? () from /usr/lib/libXt.so.6
#25 0x06916e71 in ?? () from /usr/lib/libXt.so.6
#26 0x069170ed in _XtDoPhase2Destroy () from /usr/lib/libXt.so.6
#27 0x0691add6 in XtDispatchEvent () from /usr/lib/libXt.so.6
#28 0x0691aecc in XtAppMainLoop () from /usr/lib/libXt.so.6
#29 0xf47a6661 in myMainLoop (loop=0x0)
at /data1/users/bldadmmcs/pvcs/qr_approved/mcs/src/mcs/gui/guixt.cc:1341
#30 0xf463fd61 in EventProcess (ploop=0x0)
at /data1/users/bldadmmcs/pvcs/qr_approved/mcs/src/mcs/utils/events.cc:410
#31 0x08050c25 in main (argc=1, argv=0xffb9cbf4)
at /data1/users/bldadmmcs/pvcs/qr_approved/mcs/src/mcs/workstation/ws_main.cc:2169



STACK TRACE of the process for normal case (Calling our Local Error Handler. No Crash will happen here)
------------------------------------------------------------------------
#0 0xffffe405 in __kernel_vsyscall ()
#1 0x0086d4a3 in __waitpid_nocancel () from /lib/libc.so.6
#2 0x0081207b in do_system () from /lib/libc.so.6
#3 0x00937b3d in system () from /lib/libpthread.so.0
#4 0xf46d1e50 in LocalErrorHandler (display=0xa0d6538, event=0xff9442d0)
at /data2/users/sanush/pvcs/qr_approved/mcs/src/mcs/gui/guixt.cc:453
#5 0x00abde4a in _XError () from /usr/lib/libX11.so.6
#6 0x00abf914 in _XReply () from /usr/lib/libX11.so.6
#7 0x00aa0ebc in XGetSelectionOwner () from /usr/lib/libX11.so.6
#8 0xf3cce034 in ?? () from /usr/lib/libXm.so.4
#9 0xf3cc1f2b in ?? () from /usr/lib/libXm.so.4
#10 0x06917302 in ?? () from /usr/lib/libXt.so.6
#11 0x06916ce9 in ?? () from /usr/lib/libXt.so.6
#12 0x06916ca7 in ?? () from /usr/lib/libXt.so.6
#13 0x06916ca7 in ?? () from /usr/lib/libXt.so.6
#14 0x06916ca7 in ?? () from /usr/lib/libXt.so.6
#15 0x06916ca7 in ?? () from /usr/lib/libXt.so.6
#16 0x06916e71 in ?? () from /usr/lib/libXt.so.6
#17 0x069170ed in _XtDoPhase2Destroy () from /usr/lib/libXt.so.6
#18 0x0691add6 in XtDispatchEvent () from /usr/lib/libXt.so.6
#19 0xf46d492d in myMainLoop (loop=0xa23bf58 "")at /data2/users/sanush/pvcs/qr_approved/mcs/src/mcs/gui/guixt.cc:1412
#20 0xf456ed1b in EventProcess (ploop=0xa225438)
at /data2/users/sanush/pvcs/qr_approved/mcs/src/mcs/utils/events.cc:404
#21 0xf72c88fa in ask (this=0xa2253e0)
at /data2/users/sanush/pvcs/qr_approved/mcs/src/mcs/skytec/loadperiodform.cc:935
#22 0x0804f328 in ws_initialise () at
/data2/users/sanush/pvcs/qr_approved/mcs/src/mcs/workstation/ws_main.cc:1695
#23 0x08050c08 in main (argc=1, argv=0xff944fe4)
at /data2/users/sanush/pvcs/qr_approved/mcs/src/mcs/workstation/ws_main.cc:2162

Thanks in advance.
Sanush Chacko.
 
  


Reply

Tags
motif, xlib, xwindows


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how error handling is done in C crs_zxf Programming 10 01-05-2010 08:05 AM
Help needed for error handling in C montylee Programming 11 08-27-2008 11:44 PM
Hardware Error Handling with C or C++ benz Programming 1 10-26-2007 11:18 AM


All times are GMT -5. The time now is 10:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration