<AWT Dev> <AWT dev>[9] Review request for JDK-8165555: [macosx] VM crashes on second attempt to execute JCK interactive tests that use Robot (single JVM, agent)

Manajit Halder manajit.halder at oracle.com
Wed Sep 21 13:01:52 UTC 2016


Hi Sergey,

Thanks for the comment.

Access to "instance" is not broken. The problem is with the dictionary variable "javaToMacKeyMap" within the "instance" reference. 
The dictionary is not getting initialised for the second time when singleton method is called for the second time. The dictionary is 
getting initialised during the first time singleton method is called and hence crash was observed. Tried adding self.javaToMacKeyMap
but doesn’t solve the problem. 

I propose two solutions to this problem:

Solution 1:
	Reinitialise the dictionary every-time the singleton method is called.
	Webrev: 
		http://cr.openjdk.java.net/~mhalder/8165555/webrev.01/ <http://cr.openjdk.java.net/~mhalder/8165555/webrev.01/>

	Drawback: 
		dictionary is initialised multiple times (every time singleton method is called).

Solution 2: 
	Make the dictionary static.
	Drawback:
		Still dictionary need to be initialised multiple times.
		No singleton method, just two static methods, one method to initialise the dictionary and other to get the key form the dictionary.
	
	Webrev: 
		Not prepared. Will be prepared if second solution accepted.

Test case:
	There are no test cases. Problem can be reproduced by executing following JCK test:
java -jar JCK-runtime-9/lib/jtjck.jar -mode:single -k:interactive "api/java_awt/interactive/event/EventTests.html#EventTest0019 api/java_awt/interactive/event/EventTests.html#EventTest0013” 

Thanks,
Manajit

> On 20-Sep-2016, at 4:42 am, Sergey Bylokhov <Sergey.Bylokhov at oracle.com> wrote:
> 
> Hi, Manajit.
> It seems that after the fix "(CRobotKeyCodeMapping *) sharedInstance" returns the new object per invocation, so it is not really sharedInstance. I am not sure I understand what is wrong in the current code, from the my point of view this is a correct singleton. It it true that the problem is in access to broken "instance" and not to "javaToMacKeyMap" inside the "instance"? If not then "javaToMacKeyMap" should be changed to "self.javaToMacKeyMap".
> Do you have a test case to reproduce the bug?
> 
> On 19.09.16 15:26, Manajit Halder wrote:
>> Hi All,
>> 
>> Kindly review the fix for JDK9.
>> 
>> Bug:
>> https://bugs.openjdk.java.net/browse/JDK-8165555
>> 
>> Webrev:
>> http://cr.openjdk.java.net/~mhalder/8165555/webrev.00/
>> 
>> Issue:
>> [macosx] VM crashes on second attempt to execute JCK interactive tests
>> that use Robot (single JVM, agent)
>> 
>> Cause:
>> While executing the JCK test for the second time the robot was getting
>> initialised once again and old instance of CRobotKeyCodeMapping was not
>> available.
>> Crash was observed while trying to access invalid instance of
>> CRobotKeyCodeMapping.
>> 
>> Fix:
>> A new instance of CRobotKeyCodeMapping is created when robot is initialised.
>> 
>> Regards,
>> Manajit
> 
> 
> -- 
> Best regards, Sergey.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20160921/af02a3c9/attachment.html>


More information about the awt-dev mailing list