Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 324329

Summary: [SWT_AWT] When the desktop is zoomed, launching an SWT_AWT application freezes it immediately
Product: [Eclipse Project] Platform Reporter: Christopher Deckers <chrriis>
Component: SWTAssignee: Scott Kovatch <skovatch>
Status: RESOLVED NOT_ECLIPSE QA Contact: Silenio Quarti <Silenio_Quarti>
Severity: normal    
Priority: P3 CC: skovatch, swingler
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
Sample SWT_AWT application to try to launch while desktop is zoomed
none
native trace when hung none

Description Christopher Deckers CLA 2010-09-02 12:50:15 EDT
Build Identifier: SWT 3.7M1

I found that launching an SWT_AWT application while the desktop is zoomed (I use ctrl+slide up on magic mouse) freezes the application as soon as it opens.
Standard AWT applications and standard SWT applications don't have this issue.

My Mac screen has a too high definition so I zoom the whole desktop while I develop under Eclipse. Unfortunately I have to de-zoom it everytime I launch the SWT_AWT application otherwise it freezes... *Very* frustrating.

Reproducible: Always

Steps to Reproduce:
1. Zoom the desktop (ctrl+slide up on magic mouse for example)
2. Launch an SWT_AWT application.
Comment 1 Christopher Deckers CLA 2010-09-02 12:51:13 EDT
Created attachment 178064 [details]
Sample SWT_AWT application to try to launch while desktop is zoomed
Comment 2 Scott Kovatch CLA 2010-09-02 14:12:34 EDT
Based on the stack dump when we're hung, this is an AWT bug:
=======================================

"Executing pss"
2010-09-02 10:55:51
Full thread dump Java HotSpot(TM) Client VM (17.0-b17-288 mixed mode):

"Java2D Disposer" daemon prio=10 tid=000000000191f800 nid=0xb1205000 in Object.wait() [00000000b1204000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <000000000567bb50> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
	- locked <000000000567bb50> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)
	at sun.java2d.Disposer.run(Disposer.java:127)
	at java.lang.Thread.run(Thread.java:637)

"AWT-EventQueue-0" prio=6 tid=000000000285ec00 nid=0xb1021000 runnable [00000000b1020000]
   java.lang.Thread.State: RUNNABLE
	at apple.awt.CWindow._setVisible(Native Method)
	at apple.awt.CWindow.doSetVisible(CWindow.java:711)
	at apple.awt.CWindow.setVisible(CWindow.java:720)
	at apple.awt.CComponent.show(CComponent.java:219)
	at java.awt.Component.show(Component.java:1530)
	- locked <00000000051339d0> (a java.awt.Component$AWTTreeLock)
	at java.awt.Window.show(Window.java:872)
	at java.awt.Component.show(Component.java:1563)
	at java.awt.Component.setVisible(Component.java:1515)
	at java.awt.Window.setVisible(Window.java:842)
	at test.SWTAWTExample$2.run(SWTAWTExample.java:54)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:633)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

"AWT-Shutdown" prio=5 tid=000000000284c400 nid=0xb0f1f000 in Object.wait() [00000000b0f1e000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <00000000051373c0> (a java.lang.Object)
	at java.lang.Object.wait(Object.java:485)
	at sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:265)
	- locked <00000000051373c0> (a java.lang.Object)
	at java.lang.Thread.run(Thread.java:637)

"Thread-0" daemon prio=5 tid=00000000018be000 nid=0xa0379500 runnable [00000000bfffb000]
   java.lang.Thread.State: RUNNABLE
	at apple.awt.CToolkit.doAWTRunLoop(Native Method)
	at apple.awt.CToolkit.invokeAndWait(CToolkit.java:1135)
	at apple.awt.CToolkit.invokeAndWait(CToolkit.java:1087)
	at apple.awt.CToolkit.invokeAndWait(CToolkit.java:1092)
	at apple.awt.CAccessibility.invokeAndWait(CAccessibility.java:55)
	at apple.awt.CAccessibility.getFocusOwner(CAccessibility.java:501)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend_bool(Native Method)
	at org.eclipse.swt.internal.cocoa.NSRunLoop.runMode(NSRunLoop.java:42)
	at org.eclipse.swt.widgets.Display.sleep(Display.java:4279)
	at test.SWTAWTExample.main(SWTAWTExample.java:59)

"Low Memory Detector" daemon prio=5 tid=00000000018b4000 nid=0xb0d1b000 runnable [0000000000000000]
   java.lang.Thread.State: RUNNABLE

"CompilerThread0" daemon prio=9 tid=00000000018b3000 nid=0xb0c19000 waiting on condition [0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" daemon prio=9 tid=00000000018b2400 nid=0xb0b17000 runnable [0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Surrogate Locker Thread (CMS)" daemon prio=5 tid=00000000018b1400 nid=0xb0a15000 waiting on condition [0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Finalizer" daemon prio=8 tid=00000000018a4400 nid=0xb080f000 in Object.wait() [00000000b080e000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0000000005010b10> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
	- locked <0000000005010b10> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)
	at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=00000000018a3800 nid=0xb070d000 in Object.wait() [00000000b070c000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0000000005010a18> (a java.lang.ref.Reference$Lock)
	at java.lang.Object.wait(Object.java:485)
	at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
	- locked <0000000005010a18> (a java.lang.ref.Reference$Lock)

"main" prio=5 tid=0000000002801400 nid=0xb0101000 runnable [0000000000000000]
   java.lang.Thread.State: RUNNABLE

"VM Thread" prio=9 tid=00000000018a1c00 nid=0xb060b000 runnable 

"Gang worker#0 (Parallel GC Threads)" prio=9 tid=0000000001802400 nid=0xb0305000 runnable 

"Gang worker#1 (Parallel GC Threads)" prio=9 tid=0000000001803000 nid=0xb0407000 runnable 

"Concurrent Mark-Sweep GC Thread" prio=9 tid=000000000186dc00 nid=0xb0509000 runnable 
"VM Periodic Task Thread" prio=10 tid=00000000018bd800 nid=0xb0e1d000 waiting on condition 

"Exception Catcher Thread" prio=10 tid=0000000001801400 nid=0xb0203000 runnable
Comment 3 Scott Kovatch CLA 2010-09-02 14:14:06 EDT
Created attachment 178080 [details]
native trace when hung

Native log. Of note:


Thread 1 (process 15296):
#0  0x92a0d0fa in mach_msg_trap ()
#1  0x92a0d867 in mach_msg ()
#2  0x9571efaf in __CFRunLoopRun ()
#3  0x9571e094 in CFRunLoopRunSpecific ()
#4  0x9571dec1 in CFRunLoopRunInMode ()
#5  0x98dfd378 in -[NSRunLoop(NSRunLoop) runMode:beforeDate:] ()
#6  0x0f994e31 in Java_apple_awt_CToolkit_doAWTRunLoop ()
#7  0x0300b959 in ?? ()
#8  0x03003db1 in ?? ()
#9  0x03003db1 in ?? ()
#10 0x03003db1 in ?? ()
#11 0x03003f17 in ?? ()
#12 0x03003f17 in ?? ()
#13 0x030012d3 in ?? ()
#14 0x0039e060 in JVM_Lseek ()
#15 0x0039de06 in JVM_Lseek ()
#16 0x0039ddd6 in JVM_Lseek ()
#17 0x003cf621 in JVM_FindLoadedClass ()
#18 0x003fe256 in JVM_SetNativeThreadName ()
#19 0x00082850 in JNFCallStaticObjectMethod ()
#20 0x0f9aa97c in -[JavaComponentAccessibility accessibilityFocusedUIElement] ()
#21 0x0f98b94b in -[NSViewAWT accessibilityFocusedUIElement] ()
#22 0x909de6bc in NSAccessibilityHandleFocusChangedForce ()
Comment 4 Scott Kovatch CLA 2010-09-15 15:26:46 EDT
This now happens for me just about all the time on the latest Java pre-release, whether the screen is magnified or not. Threads 1 and 17 are deadlocked because doAWTRunLoop has pushed something onto the AWT event queue and is waiting for it to finish, but the AWT queue is thread 17 which is blocked waiting for thread 1 to complete the native setVisible() operation.

Seems like I should be able to reproduce this somehow in Swing.
Comment 5 Christopher Deckers CLA 2010-10-20 16:41:39 EDT
Scott,

I saw the following on the Mac Java dev list:
"Java for Mac OS X 10.6 Update 3 and 10.5 Update 8 are live"

> This now happens for me just about all the time on the latest Java pre-release,
> whether the screen is magnified or not.

What is the status of this bug with regards to this comment?
Comment 6 Scott Kovatch CLA 2010-10-21 14:31:27 EDT
(In reply to comment #5)
> > This now happens for me just about all the time on the latest Java pre-release,
> > whether the screen is magnified or not.
> 
> What is the status of this bug with regards to this comment?

I just tried with the latest release and I don't see this problem anymore, either with a zoomed or unzoomed display. It also seems to be coincident with fixing the last of the SWT/AWT integration issues. The stack trace made it clear it was some kind of AWT problem, so it's possible that I perturbed the timing just enough that it masked the problem.

I know Mike tried it as well and was having trouble reproducing it without zooming. I don't know if he saw it with a zoomed display or not.

Give it a try with the latest I-build.
Comment 7 Scott Kovatch CLA 2010-10-22 19:18:09 EDT
Resolving as not_eclipse, since this bug seems to have gone away with the latest Java update.