JDK-6338099 : Hindi text input gets slower & hung-like effect for a particular character & also for 100+ lines
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.2_08
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: linux
  • CPU: x86
  • Submitted: 2005-10-18
  • Updated: 2011-04-28
Description
---------------------------------------------------------------------------------------
BACKGROUND:
This issue was actually reported by the team here at IEC ,India Customer Quality Engineering CTE B, reporting to Matt Thompson. They are having this bug in POC that is getting developed for a E-Gov project. 

Its a E-Gov ('e-Police' project) application getting developed for Govt. of India.
The POC uses a swing-based front end. The software architecture is pure Java(our Java). 

For detailed description of project : please find the attached text file having the extract from mail of Matt Thompson, where the project background is given.

For detailed Customer enviroment : where application is getting deployed,see the details below under Problem description.
--------------------------------------------------------------------------------------


PROBLEM Description:
=====================

* Customer environment that is targeted for the application:
Platform : Mandrake-linux [ Mandrake 10.1] on intel boxes with 265 MB RAM
jdk version needed:  1.4.2 (_04 or _08)
Input method they use: Java Indic Input Method [ Reference: http://java.sun.com/products/jfc/tsc/articles/InputMethod/inputmethod.html#Indic_Input_Method]
Locale: Hindi
Keyboard Layout: INSCRIPT


* Other test environment where the comparison tests were conducted:
JDK version: 1.4.2 , 1.5.0_b64
Input method used: Java Indic Input Method. [Problem gets shown even without using this input method , but not as immediate as with Indic input method.]
Platforms tested on: S9_sparc, RHL4.0,Windows2K
Locale :Hindi 
Keyboard layout: INSCRIPT


STEPS TO REPRODUCE:[with Java Indic Input Method]
------------------
1)Install the JDK version mentioned on the required platform. Set the JAVA_HOME & PATH variables properly. System locale being hindi.
2)To use Indic Input method- From the reference link mentioned above download the Indic-InputMethod's jar file  & then install it [place it in <jdk-home>/jre/lib/ext].
3)To use any Swing Text-editing component - use the swing application provided in jdk-demo directory. i.e under <jdk-home>/demo/jfc/Notepad. 
4)Execute this Notepad demo-application using :java -jar Notepad.jar
5)Right-click on application & choose Devanagri Input Method from the 'Select Input Methd' list & perform the following  scenarios of hindi-text-input:

case 1: 
type in continuously the character equivalent to the keypad 'f' on your keyboard. [That character's unicode equivalent is "\u093F".]

case 2: 
type in many lines of hindi text which may include the combination of this above character('f') also--- atleast 10/25+ lines, if you are using Indic-Input Method. 


PROBLEM/BUG:
------------
- you will find the text input getting very slow with the character equivalent to 'f' and when multiple lines of text is input
- gives the feeling as though the application is hung , but whereas the input is so slow that user is not able to see the text input immediately.


IMPORTANT NOTES:
---------------

1) JAVA INDIC INPUT METHOD:
if you are using this input method , the problem is seen right away at first 1 or 2 lines of input of character 'f' or 'i' itself. 
i.e for case 1 the slow performance is seen in first line itself and 
    for case 2, you can see the slowness with about 10 lines or so.


2) NATIVE INPUT METHOD:
if you are NOT making use of the Indic Input method, then login to the test system with Hindi locale & perform the input on the jdk-demo Notepad application for case 1 & case 2 given above.
[If on Solaris: you can change the IME to Hindi-INSCRIPT layout of inputting as follows: Press the keys: 'Compose' + 'h' + 'i' . You will notice in the IME window below that it takes to Indic languages. Then Press F5 till you go to Hindi.Then to go th'r the layouts, press F6 & choose Inscript layout]
-Here you will notice the problem very late  i.e slowness 
  in case 1 is viewed after 4/5 lines & 
  in case 2 the performance goes down/input becomes slow after some 75+ lines or so
i.e not as immediate as with Indic-InputMethod.


3) NON-JAVA application:
Just tested the same scenarios using the Notepad.exe on Win2K [i.e the native application on window StartMenu->Programs->Accessories->Notepad]:
login with hindi locale & start typing in the Notepad.exe only the character equivalent to 'f'. A strange behaviour was noticed here-- the input becomes like bold-square-boxes after multiple input of this character in the very first line itself !!.
[This data is mentioned just for comparison sake.]


4) OTHER CTLs:  
Used Mustang-b54 & NO Indic Input Method for THAI language input:
Tested entering some 75+ lines in Thai language on jdk-demo Notepad application & the slowness can be observed for this too.Almost hung-like effect after so many lines.



The slowness has affected the E-Gov application badly as they are making use of Indic Input Method where the user will face the problem right with 1 or 2 lines. 

Though this slowness is not observed immediately with native input methods, the problem  does exist. Hence it seems to be issue with Complex-Text handling in Swing Text-editing components itself. 

The issue needs immediate attention for any solution/workaround.

[concerning people of that project are included in Interest alias.]

Comments
EVALUATION Finally I could reproduce the problem on jdk1.4.2 After running some more tests (details are below) I think the problem is that too many objects are created and GC freezes the application every once in a while. Testing details : ( to run the test: save IndicIM.jar and bug6338099.java in the same directory and run : javac bug6338099.java && java -Djava.ext.dirs=$PWD bug6338099 ) Test simulates the steps from the bug description. It creates JFrame with JTextArea, sets input method for JTextArea to Devangary and generates rows using awt.Robot. The application is responsive if EDT can handle events promptly. The test uses swing.Timer to send an event to EDT every 10 millis and measures how long it takes for this event to be processed. Let's call the time to process that event waitTime. This waitTime indicates how responsive the application is. Test prints out last row, maximum wait time while handling the last row (maxRowWaitTime) and current maximum wait time for the application (current maxWaitTime). On the box I ran the test on average maxRowWaitTime is about 250 millis. (the box is sa.sfbay.sun.com. It is dual Pentim III 450 Mhz running linux kernel 2.4.25 smp). Every so often maxRowWaitTime becomes greater than 2000 millis and then goes back to 250 millis. Two seconds response time should feel like a freezing.
08-11-2005

EVALUATION Here are my testing results: ----- platform (jcg-linux-01.sfbay.sun.com) linux 2.4.9-e.24smp >>cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 8 model name : Pentium III (Coppermine) stepping : 3 cpu MHz : 731.477 cache size : 256 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse bogomips : 1458.17 processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 8 model name : Pentium III (Coppermine) stepping : 3 cpu MHz : 731.477 cache size : 256 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse bogomips : 1461.45 >>free total used free shared buffers cached Mem: 254076 183808 70268 0 15804 140900 -/+ buffers/cache: 27104 226972 Swap: 522104 19172 502932 ----- jdk 1.6 (latest mustang-swing build) jdk 1.4.2 Display set to XvncServer No mater what I do input does not get any slower over time. Typing in \u093f using Indic input method seems to be slower than typing in any english characters. However it is not disturbingly slow. (Keep in mind I am running the application across the country) I would like to get some clarifications. I would like to get some clarifications. 1. Could 6338099 be reproduced on jdk1.4.2 or jdk1.5 with Notepad.jar without using native compiler (JET) on any platform? 2. Could I have the specs of the platform this problem was reproduced on? (cpu, memory, os, xserver if applicable) 3. Could I have access to the box this problem is reproducible?
04-11-2005