JDK-6941572 : Won't execute a SwingWorker object with update 18
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u19
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2010-04-07
  • Updated: 2011-02-16
  • Resolved: 2011-02-07
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_19"
Java(TM) SE Runtime Environment (build 1.6.0_19-b04)
Java HotSpot(TM) Client VM (build 16.2-b04, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
After upgrading to SDK 6, update 19, some classes executing a Swingworker stopped from working, throwing no error in the console (Thread not executed).

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
We started to see the problem just upgrading the jvm 6 to update 19

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
We expected no changes in functionality.
ACTUAL -
The thread invoked from a SwingWorker never executed.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "AWT-Windows" java.lang.IllegalStateException: Shutdown in progress
        at java.lang.ApplicationShutdownHooks.add(Unknown Source)
        at java.lang.Runtime.addShutdownHook(Unknown Source)
        at sun.awt.windows.WToolkit.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.SwingWorker;

public class Hilo extends SwingWorker<Object, Object>
{
	@Override
	protected Object doInBackground() throws Exception
	{
		System.out.println("Thread executing");
		return null;
	}
}

public class TestThread
{
	public static void main(String[] args)
	{
		System.out.println("1");
		Hilo h = new Hilo();
		h.execute();
		System.out.println("2");
	}
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
import javax.swing.SwingWorker;

public class Hilo extends SwingWorker<Object, Object>
{
	@Override
	protected Object doInBackground() throws Exception
	{
		System.out.println("Thread executing");
		return null;
	}
}

public class TestThread
{
	public static void main(String[] args)
	{
		System.out.println("1");
		Hilo h = new Hilo();
		h.execute();
		System.out.println("2");
		try
		{
			Thread.sleep(1000);
			System.out.println("3");
		}
		catch(InterruptedException e)
		{
			e.printStackTrace();
		}
	}
}

Release Regression From : 6u18
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION Nobody gives information about the bug a long time. I'm closing the bug.
07-02-2011

EVALUATION SwingWorker is not executed with 6u18 as well, so it's not 6u19 specific. The fix that caused this behavior change is 6799345, when all the SwingWorker background threads were made daemons. However, I don't see why this is considered a bug. Indeed, I haven't found any place in JavaDoc about SwingWorker background threads daemon/non-daemon status. I also don't see the exception thrown from WToolkit.run(). That's why moving the bug into the Incomplete state.
14-04-2010