JDK-6576321 : Browser hang by a deadlock with open and close applet repeatedly
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 5.0u10,5.0u13
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-07-02
  • Updated: 2014-09-25
  • Resolved: 2007-09-26
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.
Other
5.0u14 b02Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
Problem Description
-------------------
A javal-level deadlock occurs when an applet is open and close repeatedly using Internet Explorer


Reproducible environment
------------------------
- Tested jre build:  PIT 5.0u13 build (Jun 28. 2007) from deployment dev:

http://sqeweb.sfbay/st2/stress_to_large_extent/jun28-build-deadlock/jre-1_5_0_13-nb-bin-20070628-windows-i586-28_jun_2007.exe

- Tested platform/browser:  XP-pro(sp2)/ IE 6 xpsp2

- How to reproduce: The detailed test instruction can be found in the attachment.


Deadlock error java stack trace logs
------------------------------------

[Loaded java.text.AttributedString$AttributedStringIterator from shared objects
file]
[Loaded sun.plugin.AppletViewer$5 from C:\PROGRA~1\Java\JRE15~1.0_1\lib\plugin.j
ar]
[Loaded sun.plugin.AppletViewer$6 from C:\PROGRA~1\Java\JRE15~1.0_1\lib\plugin.j
ar]
[Loaded java.text.FieldPosition$Delegate from C:\PROGRA~1\Java\JRE15~1.0_1\lib\r
t.jar]
[Loaded sun.applet.AppletPanel$4 from C:\PROGRA~1\Java\JRE15~1.0_1\lib\rt.jar]
[Loaded java.text.NumberFormat$Field from shared objects file]
[Loaded sun.plugin.AppletViewer$1 from C:\PROGRA~1\Java\JRE15~1.0_1\lib\plugin.j
ar]
[Loaded sun.awt.im.InputContext$1 from C:\PROGRA~1\Java\JRE15~1.0_1\lib\rt.jar]
[Loaded java.awt.LightweightDispatcher$2 from shared objects file]
[Loaded java.awt.event.AWTEventListenerProxy from shared objects file]
[Loaded java.awt.Toolkit$ToolkitEventMulticaster from shared objects file]
[Loaded sun.plugin.viewer.frame.IExplorerEmbeddedFrame$2 from C:\PROGRA~1\Java\J
RE15~1.0_1\lib\plugin.jar]
[Loaded java.awt.Window$1DisposeAction from shared objects file]
[Loaded java.util.LinkedHashMap$LinkedHashIterator from shared objects file]
[Loaded java.util.LinkedHashMap$KeyIterator from shared objects file]
[Loaded java.awt.DefaultKeyboardFocusManager$1 from C:\PROGRA~1\Java\JRE15~1.0_1
\lib\rt.jar]
[Loaded sun.awt.AppContext$4 from C:\PROGRA~1\Java\JRE15~1.0_1\lib\rt.jar]
[Loaded sun.awt.AppContext$5 from C:\PROGRA~1\Java\JRE15~1.0_1\lib\rt.jar]
[Loaded sun.reflect.GeneratedConstructorAccessor2 from __JVM_DefineClass__]
[Loaded sun.plugin.util.GrayBoxPanel from C:\PROGRA~1\Java\JRE15~1.0_1\lib\plugi
n.jar]
[Loaded sun.plugin.util.AnimationPanel from C:\PROGRA~1\Java\JRE15~1.0_1\lib\plu
gin.jar]
[Loaded sun.awt.image.OffScreenImage from shared objects file]
[Loaded java.awt.image.ImageProducer from shared objects file]
[Loaded sun.awt.image.ImageFetchable from shared objects file]
[Loaded sun.awt.image.InputStreamImageSource from shared objects file]
[Loaded sun.awt.image.URLImageSource from shared objects file]
[Loaded java.awt.MediaEntry from shared objects file]
[Loaded java.awt.ImageMediaEntry from shared objects file]
[Loaded sun.awt.image.ImageWatched from shared objects file]
[Loaded java.awt.image.ImageConsumer from shared objects file]
[Loaded sun.awt.image.ImageRepresentation from shared objects file]
[Loaded sun.awt.image.ImageWatched$Link from shared objects file]
[Loaded sun.awt.image.ImageWatched$WeakLink from shared objects file]
[Loaded sun.awt.image.ImageConsumerQueue from shared objects file]
[Loaded sun.awt.image.ImageFetcher from shared objects file]
[Loaded sun.awt.image.FetcherInfo from shared objects file]
[Loaded sun.awt.image.ImageFetcher$1 from shared objects file]
[Loaded sun.awt.image.ImageDecoder from shared objects file]
[Loaded sun.awt.image.GifImageDecoder from shared objects file]
[Loaded sun.awt.image.GifFrame from shared objects file]
[Loaded sun.awt.image.BytePackedRaster from shared objects file]
[Loaded java.awt.GradientPaint from C:\PROGRA~1\Java\JRE15~1.0_1\lib\rt.jar]
[Loaded java.awt.RenderingHints from shared objects file]
[Loaded sun.awt.SunHints from shared objects file]
[Loaded java.awt.RenderingHints$Key from shared objects file]
[Loaded sun.awt.SunHints$Key from shared objects file]
[Loaded sun.awt.SunHints$Value from shared objects file]
[Loaded java.awt.PaintContext from C:\PROGRA~1\Java\JRE15~1.0_1\lib\rt.jar]
[Loaded java.awt.GradientPaintContext from C:\PROGRA~1\Java\JRE15~1.0_1\lib\rt.j
ar]
[Loaded java.awt.geom.Point2D$Double from C:\PROGRA~1\Java\JRE15~1.0_1\lib\rt.ja
r]
[Loaded sun.java2d.pipe.AlphaPaintPipe$TileContext from C:\PROGRA~1\Java\JRE15~1
.0_1\lib\rt.jar]
[Loaded sun.awt.image.PNGImageDecoder from shared objects file]
[Loaded sun.awt.image.PNGFilterInputStream from shared objects file]
[Loaded sun.awt.image.PNGImageDecoder$Chromaticities from C:\PROGRA~1\Java\JRE15
~1.0_1\lib\rt.jar]
[Loaded java.awt.Polygon from C:\PROGRA~1\Java\JRE15~1.0_1\lib\rt.jar]
[Loaded java.awt.geom.PathIterator from shared objects file]
[Loaded java.awt.geom.GeneralPathIterator from C:\PROGRA~1\Java\JRE15~1.0_1\lib\
rt.jar]
[Loaded sun.dc.pr.Rasterizer from C:\PROGRA~1\Java\JRE15~1.0_1\lib\rt.jar]
[Loaded sun.dc.path.PathConsumer from shared objects file]
[Loaded sun.dc.pr.PathFiller from C:\PROGRA~1\Java\JRE15~1.0_1\lib\rt.jar]
[Loaded sun.dc.pr.PathStroker from shared objects file]
[Loaded sun.dc.pr.PathDasher from shared objects file]
[Loaded sun.dc.pr.Rasterizer$ConsumerDisposer from C:\PROGRA~1\Java\JRE15~1.0_1\
lib\rt.jar]
[Loaded sun.java2d.loops.GraphicsPrimitive$GeneralBinaryOp from shared objects f
ile]
[Loaded sun.java2d.loops.MaskBlit$General from shared objects file]
[Loaded sun.java2d.loops.OpaqueCopyAnyToArgb from shared objects file]
[Loaded sun.java2d.loops.OpaqueCopyArgbToAny from shared objects file]
[Loaded java.awt.SequencedEvent$1 from C:\PROGRA~1\Java\JRE15~1.0_1\lib\rt.jar]
[Loaded java.awt.Component$FlipBufferStrategy from C:\PROGRA~1\Java\JRE15~1.0_1\
lib\rt.jar]
[Loaded sun.reflect.GeneratedConstructorAccessor3 from __JVM_DefineClass__]
[Loaded java.awt.Toolkit$SelectiveAWTEventListener from shared objects file]
[Loaded netscape.javascript.JSException from C:\PROGRA~1\Java\JRE15~1.0_1\lib\pl
ugin.jar]
[Loaded sun.awt.windows.WDesktopProperties$DiffPropertyChanges from C:\PROGRA~1\
Java\JRE15~1.0_1\lib\rt.jar]
[Loaded sun.reflect.GeneratedMethodAccessor3 from __JVM_DefineClass__]
[Unloading class sun.reflect.GeneratedMethodAccessor3]
Full thread dump Java HotSpot(TM) Client VM (1.5.0_13-nb-20070628 mixed mode, sh
aring):

"thread applet-ArcTest.class" prio=4 tid=0x0515ab68 nid=0xde0 in Object.wait() [
0x0a8df000..0x0a8dfbe8]
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Unknown Source)
        at sun.applet.AppletPanel.getNextEvent(Unknown Source)
        - locked <0x20be10c0> (a sun.plugin.AppletViewer)
        at sun.applet.AppletPanel.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

"Thread-72537" prio=6 tid=0x05290d48 nid=0xf7c runnable [0x00000000..0x0a6de810]


"frame-size" prio=6 tid=0x05281c18 nid=0xfa4 waiting for monitor entry [0x09bdf0
00..0x09bdfd68]
        at sun.plugin.viewer.context.DefaultPluginAppletContext.addJSObjectToExp
ortedList(Unknown Source)
        - waiting to lock <0x20c30b78> (a java.util.ArrayList)
        at sun.plugin.javascript.ocx.JSObject.setIExplorerAppletContext(Unknown
Source)
        at sun.plugin.javascript.ocx.JSObject.invoke(Unknown Source)
        - locked <0x20c30bd0> (a sun.plugin.javascript.ocx.JSObject)
        at sun.plugin.javascript.ocx.JSObject.getMember(Unknown Source)
        at sun.plugin.AppletViewer.getDocumentBase(Unknown Source)
        - locked <0x20c30bf0> (a java.lang.Object)
        at sun.plugin.viewer.IExplorerPluginObject.initPlugin(Unknown Source)
        at sun.plugin.viewer.IExplorerPluginObject.mayInit(Unknown Source)
        at sun.plugin.viewer.IExplorerPluginObject.frameReady(Unknown Source)
        at sun.plugin.viewer.frame.IExplorerEmbeddedFrame.setFrameSize(Unknown S
ource)
        at sun.plugin.viewer.IExplorerPluginObject$2.run(Unknown Source)

"Thread-72486" prio=6 tid=0x051deb10 nid=0xc14 waiting for monitor entry [0x0923
e000..0x0923e810]
        at sun.plugin.javascript.ocx.JSObject.cleanup(Unknown Source)
        - waiting to lock <0x20c30bd0> (a sun.plugin.javascript.ocx.JSObject)
        at sun.plugin.viewer.context.DefaultPluginAppletContext.onClose(Unknown
Source)
        - locked <0x20c30b78> (a java.util.ArrayList)
        at sun.plugin.viewer.context.IExplorerAppletContext.onClose(Unknown Sour
ce)
        at sun.plugin.viewer.IExplorerPluginObject.destroyPlugin(Unknown Source)


"AWT-EventQueue-634" prio=4 tid=0x05290320 nid=0xd04 in Object.wait() [0x09adf00
0..0x09adfce8]
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Unknown Source)
        at java.awt.EventQueue.getNextEvent(Unknown Source)
        - locked <0x216890b0> (a java.awt.EventQueue)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

"TimerQueue" daemon prio=6 tid=0x05195498 nid=0xbec in Object.wait() [0x0601f000
..0x0601fd68]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x2139c678> (a javax.swing.TimerQueue)
        at javax.swing.TimerQueue.run(Unknown Source)
        - locked <0x2139c678> (a javax.swing.TimerQueue)
        at java.lang.Thread.run(Unknown Source)

"AWT-EventQueue-0" prio=6 tid=0x05183340 nid=0xbe8 in Object.wait() [0x05ecf000.
.0x05ecf9e8]
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Unknown Source)
        at java.awt.EventQueue.getNextEvent(Unknown Source)
        - locked <0x212f7600> (a java.awt.EventQueue)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

"ConsoleWriterThread" daemon prio=6 tid=0x0512e730 nid=0xbe4 in Object.wait() [0
x05dcf000..0x05dcfa68]
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Unknown Source)
        at com.sun.deploy.util.ConsoleTraceListener$ConsoleWriterThread.run(Unkn
own Source)
        - locked <0x213478a8> (a java.lang.Object)

"AWT-EventQueue-1" prio=6 tid=0x051299c0 nid=0xbe0 in Object.wait() [0x05ccf000.
.0x05ccfae8]
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Unknown Source)
        at java.awt.EventQueue.getNextEvent(Unknown Source)
        - locked <0x21338e88> (a java.awt.EventQueue)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

"AWT-Shutdown" prio=6 tid=0x025eb868 nid=0xb90 in Object.wait() [0x054ef000..0x0
54efb68]
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Unknown Source)
        at sun.awt.AWTAutoShutdown.run(Unknown Source)
        - locked <0x21302888> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

"traceMsgQueueThread" daemon prio=6 tid=0x05116258 nid=0xbd0 in Object.wait() [0
x057ff000..0x057ffc68]
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Unknown Source)
        at com.sun.deploy.util.Trace$TraceMsgQueueChecker.run(Unknown Source)
        - locked <0x213028b0> (a java.util.ArrayList)
        at java.lang.Thread.run(Unknown Source)

"AWT-Windows" daemon prio=6 tid=0x05111fe0 nid=0xbd8 runnable [0x055ef000..0x055
efce8]
        at sun.awt.windows.WToolkit.eventLoop(Native Method)
        at sun.awt.windows.WToolkit.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

"Java2D Disposer" daemon prio=10 tid=0x051117c8 nid=0x7fc in Object.wait() [0x05
3ef000..0x053ef9e8]
        at java.lang.Object.wait(Native Method)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        - locked <0x21302988> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        at sun.java2d.Disposer.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

"Low Memory Detector" daemon prio=6 tid=0x025a6988 nid=0xbb8 runnable [0x0000000
0..0x00000000]

"CompilerThread0" daemon prio=10 tid=0x025a5568 nid=0xbc4 waiting on condition [
0x00000000..0x04edf8c8]

"Signal Dispatcher" daemon prio=10 tid=0x025a48e0 nid=0x414 waiting on condition
 [0x00000000..0x00000000]

"Finalizer" daemon prio=8 tid=0x02573a28 nid=0xbb4 in Object.wait() [0x04cdf000.
.0x04cdfc68]
        at java.lang.Object.wait(Native Method)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        - locked <0x21302b38> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)

"Reference Handler" daemon prio=10 tid=0x025725a8 nid=0xed8 in Object.wait() [0x
04bdf000..0x04bdfce8]
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Unknown Source)
        at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
        - locked <0x21302810> (a java.lang.ref.Reference$Lock)

"VM Thread" prio=10 tid=0x02571368 nid=0xed4 runnable

"VM Periodic Task Thread" prio=10 tid=0x025a7be0 nid=0xa0c waiting on condition



Found one Java-level deadlock:
=============================
"frame-size":
  waiting to lock monitor 0x0257367c (object 0x20c30b78, a java.util.ArrayList),

  which is held by "Thread-72486"
"Thread-72486":
  waiting to lock monitor 0x0257365c (object 0x20c30bd0, a sun.plugin.javascript
.ocx.JSObject),
  which is held by "frame-size"

Java stack information for the threads listed above:
===================================================
"frame-size":
        at sun.plugin.viewer.context.DefaultPluginAppletContext.addJSObjectToExp
ortedList(Unknown Source)
        - waiting to lock <0x20c30b78> (a java.util.ArrayList)
        at sun.plugin.javascript.ocx.JSObject.setIExplorerAppletContext(Unknown
Source)
        at sun.plugin.javascript.ocx.JSObject.invoke(Unknown Source)
        - locked <0x20c30bd0> (a sun.plugin.javascript.ocx.JSObject)
        at sun.plugin.javascript.ocx.JSObject.getMember(Unknown Source)
        at sun.plugin.AppletViewer.getDocumentBase(Unknown Source)
        - locked <0x20c30bf0> (a java.lang.Object)
        at sun.plugin.viewer.IExplorerPluginObject.initPlugin(Unknown Source)
        at sun.plugin.viewer.IExplorerPluginObject.mayInit(Unknown Source)
        at sun.plugin.viewer.IExplorerPluginObject.frameReady(Unknown Source)
        at sun.plugin.viewer.frame.IExplorerEmbeddedFrame.setFrameSize(Unknown S
ource)
        at sun.plugin.viewer.IExplorerPluginObject$2.run(Unknown Source)
"Thread-72486":
        at sun.plugin.javascript.ocx.JSObject.cleanup(Unknown Source)
        - waiting to lock <0x20c30bd0> (a sun.plugin.javascript.ocx.JSObject)
        at sun.plugin.viewer.context.DefaultPluginAppletContext.onClose(Unknown
Source)
        - locked <0x20c30b78> (a java.util.ArrayList)
        at sun.plugin.viewer.context.IExplorerAppletContext.onClose(Unknown Sour
ce)
        at sun.plugin.viewer.IExplorerPluginObject.destroyPlugin(Unknown Source)


Found 1 deadlock.

Comments
EVALUATION The root cause of the deadlock is in JSObject cleanup. 1 One thread is doing Java->JS call. It locks JSObject in JSObject.invoke() and tries to lock the AppletContext's "exported" list to add the JSObject to it. 2 Another thread is in destroying applet. It calls AppletContext.onClose to release JSObjects. The thread locks the "exported" list and tries to lock the JSObject to do cleanup(). This is a classic deadlock scenario. The fix to 6418035 was trying to avoid only one case which is Plugin calls javascript to get DocumentBase. It did not get to the bottome of the deadlock. In this sense, this bug is not really a regression.
10-07-2007

EVALUATION This is "reincarnation" of bug 6489165. Before the 5u11 fix to 6489165, the deadlock was caused by race between the main thread and Initer thread. The fix was to move some code from the Initer thread to the main thread. Since 5u12 (after fix to 6418035), "the code" runs on frame-size thread which can deadlock with the main thread again. This issue is a regression caused by fix to 6418035.
02-07-2007