Bug 437790

Summary: LTC37141-Application is hung up during key event handling
Product: Red Hat Enterprise Linux 5 Reporter: Alan Matsuoka <alanm>
Component: libX11Assignee: Peter Hutterer <peter.hutterer>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5.1CC: cmeadors, cward, eng-i18n-bugs, ktakemur, llim, peter.hutterer, petersen, phuang, rlerch, rousseau, sandmann, sghosh, syeghiay, tagoh, tao, xgl-maint
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: A possible race condition between a client and the input method server. Consequence: Applications using input methods may hang and not accept keyboard input. Fix: Increase the number of available atoms for temporary storage of IM data. Result: The frequency of the bug is significantly reduced but the bug may still be triggered under some circumstances.
Story Points: ---
Clone Of:
: 510658 (view as bug list) Environment:
Last Closed: 2009-09-02 10:13:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 510658    
Bug Blocks:    
Attachments:
Description Flags
file attachment from LTC:LTC37141.patch
none
test program
none
test program and core file
none
Snapshot none

Description Alan Matsuoka 2008-03-17 14:10:42 UTC
LTC Owner is: shoji.com
LTC Originator is: takiguc.com


---Problem Description---
Application is hung up during key event handling on Japanese environment.
It seems scim or scim-anthy may have some problem.

---uname output---
Linux xxx.xxx.ibm.com 2.6.18-8.el5xen #1 SMP Fri Jan 26 14:42:21 EST 2007 i686
i686 i386 GNU/Linux

Machine Type = IA32

---Debugger---
A debugger is not configured

---Steps to Reproduce---
This testing requires openmotif and openmotif-devel rpm packages:

1. Login with RHEL5 Japanese environment
2. Compile and run test program (it will be attached)
3. Two TextFields are displayed. Trun on IM by using Ctl-Space on
  each TextField
4. Type some Japanese characters on both TextField and commit them
5. Press F4 key to change input focus and keep it about 30 secs
6. Then input focus will not changed by F4 <== PROBLEM
7. If you can change input focus by using F4, please try step 5 again
8. Stack trace is as follows:
==================================================
(gdb) bt
#0  0x00b8a402 in __kernel_vsyscall ()
#1  0x0021237b in poll () from /lib/i686/nosegneg/libc.so.6
#2  0x007e9a19 in XAddConnectionWatch () from /usr/lib/libX11.so.6
#3  0x007e9dff in _XRead () from /usr/lib/libX11.so.6
#4  0x007eb64b in _XReadEvents () from /usr/lib/libX11.so.6
#5  0x007ccff2 in XIfEvent () from /usr/lib/libX11.so.6
#6  0x0081433e in _XimXConf () from /usr/lib/libX11.so.6
#7  0x0080c607 in _XimFlush () from /usr/lib/libX11.so.6
#8  0x0080c9d3 in _XimRead () from /usr/lib/libX11.so.6
#9  0x0081ab1d in _XimTransFilterWaitEvent () from /usr/lib/libX11.so.6
#10 0x007f6915 in XSetICValues () from /usr/lib/libX11.so.6
#11 0x04ba1c7f in XmImUnregister () from /usr/lib/libXm.so.4
#12 0x04ba2a77 in XmImSetFocusValues () from /usr/lib/libXm.so.4
#13 0x04ba2e44 in XmImVaSetFocusValues () from /usr/lib/libXm.so.4
#14 0x04b80895 in XmTextFieldSetAddMode () from /usr/lib/libXm.so.4
#15 0x006a4421 in _XtDestroyTMData () from /usr/lib/libXt.so.6
#16 0x006a47fa in _XtDestroyTMData () from /usr/lib/libXt.so.6
#17 0x006a4df4 in _XtTranslateEvent () from /usr/lib/libXt.so.6
#18 0x0067c690 in XtDispatchEventToWidget () from /usr/lib/libXt.so.6
#19 0x0067ca91 in _XtSendFocusEvent () from /usr/lib/libXt.so.6
#20 0x006853fd in XtGetKeyboardFocusWidget () from /usr/lib/libXt.so.6
#21 0x006856e9 in XtSetKeyboardFocus () from /usr/lib/libXt.so.6
#22 0x04b927a9 in _XmMgrTraversal () from /usr/lib/libXm.so.4
#23 0x04b929d9 in XmProcessTraversal () from /usr/lib/libXm.so.4
#24 0x080486bc in keyEH (w=0x97c7490, client_data=0x97bc170, xev=0xbfb81228)
   at motiftextf2.c:21
#25 0x0067c405 in XtDispatchEventToWidget () from /usr/lib/libXt.so.6
#26 0x0067ceaa in _XtSendFocusEvent () from /usr/lib/libXt.so.6
#27 0x0067bd17 in XtDispatchEvent () from /usr/lib/libXt.so.6
#28 0x0067becc in XtAppMainLoop () from /usr/lib/libXt.so.6
#29 0x0804885a in main (argc=1, argv=0xbfb81434) at motiftextf2.c:50
======================================================

---XFree86/X.org Component Data---
Adapter and monitor type: LCD 1280x1024, i865G



I could reproduce the problem.

#0  0x00110402 in __kernel_vsyscall ()
#1  0x0079557b in poll () from /lib/libc.so.6
#2  0x0015d195 in _XWaitForReadable (dpy=0x9d892f8) at XlibInt.c:498
#3  0x0015e6c6 in _XRead (dpy=0x9d892f8, data=0xbfea8558 "n


 ----- Additional Comments From mranweil.com (prefers email at
mjr.com)  2008-03-03 16:15 EDT -------
Joe - to at least partly answer your questions (and make this unstale) by
summarizing some internal comments on this side:

The problem does recreate on 5.1.

Here is a somewhat more detailed recreate scenario:
1. Login with RHEL5 Japanese environment
2. Compile and run test program (it will be attached)
2A.Make sure XMODIFERS environment variable. If not, export it.
  $ echo $XMODIFIERS
  @im=SCIM
  $ export XMODIFIERS=@im=SCIM
3. Two TextFields are displayed. Trun on IM by using Ctl-Space on
  each TextField
4. Type some Japanese characters on both TextField and commit them
4A.Type "aaaaaa" then you'll get Japanese characters, then press Enter
  to commit the characters. You can also type "iiiii" or "uuuuu" then
  press Enter to commit them on other TextField.
5. Press F4 key to change input focus and keep it about 30 secs
5A.If you press F4 key, input focus is moved to other TextField.
  You must keep pressing the F4 key for 30 seconds.
  While you keep pressing the F4 key, the input focus is moving
  between the TextFields.
6. Then input focus will not changed by F4 <== PROBLEM
7. If you can change input focus by using F4, please try step 5 again

Does that help?  Anything else needed?


Status set to: Waiting on Tech 

Notes from SEG:

I haven't been able to reproduce the problem and neither has anybody else on the
hardware that
we have available to us.

The patch doesn't appear to cause any new problems and it seems to be OK.

Comment 1 Alan Matsuoka 2008-03-17 14:10:43 UTC
Created attachment 298267 [details]
file attachment from LTC:LTC37141.patch

Comment 2 Alan Matsuoka 2008-03-17 14:12:13 UTC
Created attachment 298268 [details]
test program

Comment 8 Søren Sandmann Pedersen 2009-04-22 21:30:30 UTC
Note that motif programs has to be compiled like this:

    gcc app.c -lXm -lXt

rather than

    gcc app.c -lXt -lXm

Otherwise they fail with protocol errors. (I don't know what underlying brain damage is causing this).

Comment 9 Peter Hutterer 2009-04-30 03:41:40 UTC
MODIFIED
libX11-1.0.3-11 is available in brew

Comment 11 Kenichi Takemura 2009-05-13 06:16:08 UTC
I tested using the patch but still the problem happens.
Please find here bellows information about the test I had.
I will attach the screen snapshot.

To produce this bug, I change keyboard-properites by gnome-keyboard-properties.
$ gnome-keyboard-properties
	Keyboard tab - Repeat Keys
	- Tick 'Key presses repeat when key is held down
	- Delay is set to Shortest position.
	- Speed psi set to Fastest position.

It took approximately from 10 to 20 minutes to produce the bug.

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 5 (Tikanga)
# uname -a
Linux unused-12-193.bne.redhat.com 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 athlon i386 GNU/Linux

# rpm -qa | grep X11
libX11-1.0.3-11.el5
libX11-devel-1.0.3-11.el5
libX11-debuginfo-1.0.3-11.el5

The backtrace was from gdb.
To get the backtrace, I used gcore to get coredump after compiling the program with -g option.
$ gcc -g motiftextf2.c -lXm -lXt
$ gcore 8334
$ gdb ./a.out core.8334

The executable(a.out) and coredump will be also attached.

(gdb) bt
#0  0x00486402 in __kernel_vsyscall ()
#1  0x4e02793b in poll () from /lib/libc.so.6
#2  0x0038aaa9 in _XWaitForReadable (dpy=0x8e7d2f8) at XlibInt.c:498
#3  0x0038ae8f in _XRead (dpy=0x8e7d2f8, data=0xbff970b8 "\b\004����\2168D", size=32) at XlibInt.c:1087
#4  0x0038c6cb in _XReadEvents (dpy=0x8e7d2f8) at XlibInt.c:1003
#5  0x0036e032 in XIfEvent (dpy=0x8e7d2f8, event=0xbff97984, predicate=0x3afe80 <_CheckCMEvent>, 
    arg=0x8e95b48 "8�D") at IfEvent.c:70
#6  0x003b046e in _XimXRead (im=0x8e95b48, recv_buf=0xbff97b10 "", buf_len=2048, ret_len=0xbff97a58)
    at imTrX.c:447
#7  0x003b3297 in _XimReadData (im=0x8e95b48, len=0xbff97a9a, buf=0xbff97b10 "", buf_size=2048)
    at imTransR.c:154
#8  0x003b3663 in _XimRead (im=0x8e95b48, len=0xbff98c1a, buf=0xbff97b10 "", buf_size=2048, 
    predicate=0x3ae200 <_XimSetICValuesCheck>, arg=0x8e97788 "`�D") at imTransR.c:231
#9  0x003af25d in _XimProtoSetICValues (xic=0x8e97788, arg=0x0) at imDefIc.c:759
#10 0x00397a05 in XSetICValues (ic=0x8e97788) at ICWrap.c:339
#11 0x4e7ed65f in ?? () from /usr/lib/libXm.so.4
#12 0x4e7ee436 in XmImSetFocusValues () from /usr/lib/libXm.so.4
#13 0x4e7ee7e4 in XmImVaSetFocusValues () from /usr/lib/libXm.so.4
#14 0x4e7cbde5 in ?? () from /usr/lib/libXm.so.4
#15 0x4e1c9421 in ?? () from /usr/lib/libXt.so.6
#16 0x4e1c97fa in ?? () from /usr/lib/libXt.so.6
#17 0x4e1c9df4 in _XtTranslateEvent () from /usr/lib/libXt.so.6
#18 0x4e1a1690 in XtDispatchEventToWidget () from /usr/lib/libXt.so.6
#19 0x4e1a1a91 in _XtSendFocusEvent () from /usr/lib/libXt.so.6
#20 0x4e1aa3fd in ?? () from /usr/lib/libXt.so.6
#21 0x4e1aa6e9 in XtSetKeyboardFocus () from /usr/lib/libXt.so.6
#22 0x4e7ddff4 in _XmMgrTraversal () from /usr/lib/libXm.so.4
#23 0x4e7de1d9 in XmProcessTraversal () from /usr/lib/libXm.so.4
#24 0x080486ec in keyEH (w=0x8ea3fd8, client_data=0x8ea1580, xev=0xbff99658) at motiftextf2.c:20
#25 0x4e1a1405 in XtDispatchEventToWidget () from /usr/lib/libXt.so.6
#26 0x4e1a1eaa in ?? () from /usr/lib/libXt.so.6
#27 0x4e1a0d17 in XtDispatchEvent () from /usr/lib/libXt.so.6
#28 0x4e1a0ecc in XtAppMainLoop () from /usr/lib/libXt.so.6
#29 0x0804888a in main (argc=1, argv=0xbff99864) at motiftextf2.c:49

Comment 12 Kenichi Takemura 2009-05-13 06:21:06 UTC
Created attachment 343708 [details]
test program and core file

Comment 13 Kenichi Takemura 2009-05-13 06:21:55 UTC
Created attachment 343709 [details]
Snapshot

Comment 14 Peter Hutterer 2009-06-05 03:57:18 UTC
It seems that this bug is caused by a race condition in the XIM protocol. An example of how this race condition can be triggered is described in Comment 19 or Bug 452849.

https://bugzilla.redhat.com/show_bug.cgi?id=452849#c19

Comment 15 Akira TAGOH 2009-06-08 01:25:27 UTC
I guess similar issue may happened as Peter said. i.e. the client is waiting for any responses synchronously as well as the server. given that the above patch makes it harder to appear this issue, it may be likely dropping any events at the server side, which contains multiple events in one atom. I'm wondering if this happens with SCIM applied a patch from Bug #466657 then.

Comment 18 Peter Hutterer 2009-06-18 05:12:35 UTC
Release note added. If any revisions are required, please set the 
"requires_release_notes" flag to "?" and edit the "Release Notes" field accordingly.
All revisions will be proofread by the Engineering Content Services team.

New Contents:
Cause: A possible race condition between a client and the input method server.

Consequence: Applications using input methods may hang and not accept keyboard input.

Fix: Increase the number of available atoms for temporary storage of IM data.

Result: The frequency of the bug is significantly reduced but the bug may still be triggered under some circumstances.

Comment 19 Peter Hutterer 2009-06-19 03:52:15 UTC
Please see the release notes added.

Comment 21 Peter Hutterer 2009-06-24 22:07:32 UTC
MODIFIED
Ready for QA again.

Comment 25 Chris Ward 2009-07-03 18:01:13 UTC
~~ Attention - RHEL 5.4 Beta Released! ~~

RHEL 5.4 Beta has been released! There should be a fix present in the Beta release that addresses this particular request. Please test and report back results here, at your earliest convenience. RHEL 5.4 General Availability release is just around the corner!

If you encounter any issues while testing Beta, please describe the issues you have encountered and set the bug into NEED_INFO. If you encounter new issues, please clone this bug to open a new issue and request it be reviewed for inclusion in RHEL 5.4 or a later update, if it is not of urgent severity.

Please do not flip the bug status to VERIFIED. Only post your verification results, and if available, update Verified field with the appropriate value.

Questions can be posted to this bug or your customer or partner representative.

Comment 29 Kenichi Takemura 2009-08-06 04:47:48 UTC
Verified the bug(Ensured the problem does not occur during a couple of hours operation).
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
Linux 2.6.18-159.el5PAE #1 SMP Mon Jul 20 18:31:07 EDT 2009 i686 i686 i386 GNU/Linux

Comment 30 errata-xmlrpc 2009-09-02 10:13:26 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-1332.html