<AWT Dev> [11][JDK-8152974] AWT hang occurs when sequenced events

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Fri Mar 16 16:56:37 UTC 2018


On 16/03/2018 08:42, semyon.sadetsky at oracle.com wrote:
> That's funny. And who gave you such strong confidence? Sergey? to whom 
> you are so grateful?
> I'd better ask him for other ideas because the change should never go 
> into the repo.

We are grateful to you for your opinion, but you haven't provided the 
reasonable claims, this change corrects the bug (proved by the test), 
works in several appcontext(proved by the test), about what you objects?

>>
>> When I said two app contexts, one is created by default, and I have 
>> created another one explicitly, which is why I said 2 app contexts.
>> Event one is posted on the default context, whereas the other two are 
>> posted on the newly created context. And I have also added two dummy 
>> events between two sequenced events just to make sure that, that case 
>> also works.
>>
>> Thanks,
>> Krishna
>>
>> -----Original Message-----
>> From: Semyon Sadetsky
>> Sent: Friday, March 16, 2018 12:01 AM
>> To: Krishna Addepalli <krishna.addepalli at oracle.com>; 
>> awt-dev at openjdk.java.net
>> Subject: Re: <AWT Dev> [11][JDK-8152974] AWT hang occurs when 
>> sequenced events
>>
>> Please understand that you are modifying the mechanism that is 
>> responsible for synchronization between different application contexts.
>>
>> You must prove that you did not broke it with your change. But the 
>> provided test contains one context only.
>>
>> On 03/15/2018 10:30 AM, Krishna Addepalli wrote:
>>> Yes, When we create SequencedEvents, only FOCUS_LAST+1 ids are pushed 
>>> to the queue, but no event with FOCUS_LAST+2 are pushed. The 
>>> order(creation) is maintained by having a static List.
>>> There is only one public constructor for SequencedEvents, and it
>>> always creates with FOCUS_LAST + 1 as the id for all the events. So,
>>> there is no event with FOCUS_LAST + 2 being pushed in the context of a
>>> SequencedEvent.,
>>>
>>> Also, looking at the logic of the code, what we are saying is that 
>>> all the SequencedEvents should be processed before any other events 
>>> in the event queue. Thanks to Sergey for pointing this one out.
>>>
>>> My test case already contains two app contexts, and I have posted 
>>> events on both, creating a dependency between them. Let me know if 
>>> you want me to add more app contexts.
>>>
>>> Thanks,
>>> Krishna
>>>
>>> -----Original Message-----
>>> From: Semyon Sadetsky
>>> Sent: Thursday, March 15, 2018 10:48 PM
>>> To: Krishna Addepalli <krishna.addepalli at oracle.com>;
>>> awt-dev at openjdk.java.net
>>> Subject: Re: <AWT Dev> [11][JDK-8152974] AWT hang occurs when
>>> sequenced events
>>>
>>> On 03/15/2018 10:11 AM, Krishna Addepalli wrote:
>>>
>>>> If no such event is posted to the queue, it will lead to hang right?
>>> Are you sure that the root cause is that there are no such event?
>>> I think the event is enqueued but its order is wrong.
>>>
>>> The test to the fix must contain several application contexts because 
>>> this mechanism provides synchronization between contexts.
>>>
>>> --Semyon
>>>> And also, the correct order of processing is not by the event 
>>>> number, but rather by the condition check to see if the current 
>>>> event is the first event in the separate list maintained for 
>>>> SequencedEvents.
>>>> Just repeating it for reference:
>>>> "edt.pumpEvents(ID, () -> !SequencedEvent.this.isFirstOrDisposed());"
>>>>
>>>> Thanks,
>>>> Krishna
>>>>
>>>> -----Original Message-----
>>>> From: Semyon Sadetsky
>>>> Sent: Thursday, March 15, 2018 10:36 PM
>>>> To: Krishna Addepalli <krishna.addepalli at oracle.com>;
>>>> awt-dev at openjdk.java.net
>>>> Subject: Re: <AWT Dev> [11][JDK-8152974] AWT hang occurs when
>>>> sequenced events
>>>>
>>>> On 03/15/2018 09:59 AM, Krishna Addepalli wrote:
>>>>
>>>>> Hi Semyon,
>>>>>
>>>>> SequencedEvent is created with FOCUS_LAST + 1 as its id, whereas 
>>>>> when it is dispatching events, it is looking for FOCUS_LAST + 2, 
>>>>> which is causing the hang.
>>>> I think it correctly waits for FOCUS_LAST + 2 to guaranty the right 
>>>> order of processing in which the sequenced event is first processed 
>>>> on another EDT.
>>>> --Semyon
>>>>> I have modified it to look for only FOCUS_LAST + 1 events, which 
>>>>> has fixed the problem.
>>>>>
>>>>> Thanks,
>>>>> Krishna
>>>>>
>>>>> -----Original Message-----
>>>>> From: Semyon Sadetsky
>>>>> Sent: Thursday, March 15, 2018 9:14 PM
>>>>> To: Krishna Addepalli <krishna.addepalli at oracle.com>;
>>>>> awt-dev at openjdk.java.net
>>>>> Subject: Re: <AWT Dev> [11][JDK-8152974] AWT hang occurs when
>>>>> sequenced events
>>>>>
>>>>> Hi Krishna,
>>>>>
>>>>> You have replaced FOCUS_LAST+2 with the FOCUS_LAST+1 which is 
>>>>> absolutely different event.
>>>>>
>>>>> They can be used interchangeably?
>>>>>
>>>>> --Semyon
>>>>>
>>>>>
>>>>> On 03/14/2018 07:53 AM, Krishna Addepalli wrote:
>>>>>> Hi Sergey,
>>>>>>
>>>>>> As per our discussion, I have modified the fix to process only 
>>>>>> SequencedEvents and ignore others. I have also modified the test 
>>>>>> case to include some dummy events between two SequencedEvents, and 
>>>>>> it works.
>>>>>> Here is the new webrev:
>>>>>> http://cr.openjdk.java.net/~kaddepalli/8152974/webrev01/
>>>>>>
>>>>>> However, could you point me to a doc/spec which says that all the 
>>>>>> SequencedEvents have to be processed together, even if other 
>>>>>> events in the queue have arrived before?
>>>>>>
>>>>>> Thanks,
>>>>>> Krishna
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Krishna Addepalli
>>>>>> Sent: Saturday, February 17, 2018 7:57 AM
>>>>>> To: Sergey Bylokhov <sergey.bylokhov at oracle.com>;
>>>>>> awt-dev at openjdk.java.net; Semyon Sadetsky
>>>>>> <semyon.sadetsky at oracle.com>
>>>>>> Subject: RE: <AWT Dev> [11][JDK-8152974] AWT hang occurs when
>>>>>> sequenced events
>>>>>>
>>>>>> Hi Sergey,
>>>>>>
>>>>>> The event is present, but with the id 
>>>>>> "java.awt.event.FocusEvent.FOCUS_LAST+1", whereas when it is 
>>>>>> pumping the events, it is looking for 
>>>>>> "java.awt.event.FocusEvent.FOCUS_LAST+2", which is not in the queue.
>>>>>>
>>>>>> Thanks,
>>>>>> Krishna
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Sergey Bylokhov
>>>>>> Sent: Saturday, February 17, 2018 1:49 AM
>>>>>> To: Krishna Addepalli <krishna.addepalli at oracle.com>;
>>>>>> awt-dev at openjdk.java.net; Semyon Sadetsky
>>>>>> <semyon.sadetsky at oracle.com>
>>>>>> Subject: Re: <AWT Dev> [11][JDK-8152974] AWT hang occurs when
>>>>>> sequenced events
>>>>>>
>>>>>> Hi, Krishna.
>>>>>> On 16/02/2018 00:42, Krishna Addepalli wrote:
>>>>>>> The SentEvent.ID value is 
>>>>>>> "java.awt.event.FocusEvent.FOCUS_LAST+2", and when in the 
>>>>>>> function pumpOneEventForFilters, it tries to call 
>>>>>>> EventQueue.getNextEvent(id), it looks for SentEvent.ID, which is 
>>>>>>> not present, and then the queue blocks in the hope that someone 
>>>>>>> will post that event. This is what is leading to the hang.
>>>>>> But both events are posted by the test, why the second event is 
>>>>>> not present in the queue?
>>>>>>
>>>>>>
> 


-- 
Best regards, Sergey.


More information about the awt-dev mailing list