JDK-8080504 : [macosx] SunToolkit.realSync() may hang
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 8,9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: generic
  • Submitted: 2015-05-15
  • Updated: 2018-02-15
  • Resolved: 2015-06-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u162Fixed 9 b74Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
When nested AppKit loop is initiated the call to SunToolkit.realSync() may not return since the Java_sun_lwawt_macosx_LWCToolkit_nativeSyncQueue method doesn't honor the timeout argument.
Comments
This fix can't be easily verified. The accessibility tool need to be turned on and the AWT sources need to be patched to reproduce the hang.
29-06-2015

Final webrev: http://cr.openjdk.java.net/~anashaty/8080504/webrev.01/
29-06-2015

Webrev: http://cr.openjdk.java.net/~anashaty/8080504/webrev.00/
23-06-2015

The fix draft: --- a/src/macosx/native/sun/awt/LWCToolkit.m Fri Mar 27 19:13:47 2015 +0000 +++ b/src/macosx/native/sun/awt/LWCToolkit.m Fri May 15 19:18:22 2015 +0400 @@ -92,11 +92,13 @@ { int currentEventNum = [AWTToolkit getEventCount]; NSApplication* sharedApp = [NSApplication sharedApplication]; if ([sharedApp isKindOfClass:[NSApplicationAWT class]]) { NSApplicationAWT* theApp = (NSApplicationAWT*)sharedApp; [theApp postDummyEvent]; - [theApp waitForDummyEvent]; + [theApp waitForDummyEvent:(int)timeout]; } else { // could happen if we are embedded inside SWT application, // in this case just spin a single empty block through --- a/src/macosx/native/sun/osxapp/NSApplicationAWT.h Fri Mar 27 19:13:47 2015 +0000 +++ b/src/macosx/native/sun/osxapp/NSApplicationAWT.h Fri May 15 19:18:22 2015 +0400 @@ -37,7 +37,8 @@ - (void) registerWithProcessManager; - (void) setDockIconWithEnv:(JNIEnv *)env; - (void) postDummyEvent; -- (void) waitForDummyEvent; +- (void) waitForDummyEvent:(int) timeout; --- a/src/macosx/native/sun/osxapp/NSApplicationAWT.m Fri Mar 27 19:13:47 2015 +0000 +++ b/src/macosx/native/sun/osxapp/NSApplicationAWT.m Fri May 15 19:18:22 2015 +0400 @@ -368,8 +397,10 @@ [pool drain]; } -- (void)waitForDummyEvent { - [seenDummyEventLock lockWhenCondition:YES]; +- (void)waitForDummyEvent:(int) timeout { + double sec = ((double) timeout)/1000; + [seenDummyEventLock lockWhenCondition:YES + beforeDate:[NSDate dateWithTimeIntervalSinceNow:sec]]; [seenDummyEventLock unlock]; [seenDummyEventLock release];
15-05-2015