JDK-8049354 : Hang in CCLGraphicsConfig.getMaxTextureSize()
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 8
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: other
  • CPU: x86
  • Submitted: 2014-06-27
  • Updated: 2014-08-01
  • Resolved: 2014-08-01
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 9
9Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
jdk 1.8.0_05

ADDITIONAL OS VERSION INFORMATION :
Mac Os - 10.9.3 (Mavericks)

A DESCRIPTION OF THE PROBLEM :
I have a Java FX program which uses a SwingNode to wrap a JFreeChart. I'm getting a repeated hang in CCLGraphicsConfig.getMaxTextureSize(). 








ADDITIONAL REGRESSION INFORMATION: 
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the enclosed code. Sorry - it uses a minimalist JFreeChart because i don't immediately know how to render stuff in Swing.  The code hangs even before the full application starts up. Use a ide to suspend the AWT thread and you will see it stuck at CCLGraphicsConfig.getMaxTextureSize()

I note that hang bugs in this function for the mac have been reported before - notably:
JDK-8000794 : [macosx] Stuck in sun.java2d.opengl.CGLGraphicsConfig.getMaxTextureSize(Native Method)
and:
JDK-8000471 : [macosx] Stuck in sun.java2d.opengl.CGLGraphicsConfig.getMaxTextureSize(Native Method)

have the fixes not been ported over to JDK 8?


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The chart should display. This works fine on a PC.
ACTUAL -
Application fails to start up.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error message - hang inside getMaxTextureSize. Doesnt appear to be deadlock.

The stack items are:

CGLGraphicsConfig.getMaxTextureSize() line: not available [native method]	
CGLGraphicsConfig.getMaxTextureWidth() line: 457 [local variables unavailable]	
LWLightweightFramePeer(LWWindowPeer).updateMinimumSize() line: 434 [local variables unavailable]	
LWLightweightFramePeer(LWWindowPeer).initializeImpl() line: 183 [local variables unavailable]	
LWLightweightFramePeer(LWComponentPeer<T,D>).initialize() line: 313 [local variables unavailable]	
LWCToolkit(LWToolkit).createDelegatedLwPeer(LightweightFrame, PlatformComponent, PlatformWindow) line: 221	
LWCToolkit(LWToolkit).createLightweightFrame(LightweightFrame) line: 229	
JLightweightFrame(LightweightFrame).addNotify() line: 87 [local variables unavailable]	
JLightweightFrame(Window).show() line: 1031 [local variables unavailable]	
JLightweightFrame(Component).show(boolean) line: 1656	
JLightweightFrame(Component).setVisible(boolean) line: 1608	
JLightweightFrame(Window).setVisible(boolean) line: 1014	
SwingNode.setContentImpl(JComponent) line: 229	
SwingNode.access$400(SwingNode, JComponent) line: 114	
SwingNode$2.run() line: 174 [local variables unavailable]	
SwingFXUtils.runOnEDT(Runnable) line: 221	
SwingNode.setContent(JComponent) line: 171	

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
package demo;

import javafx.application.Application;
import javafx.embed.swing.SwingNode;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

import javax.swing.SwingUtilities;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;

public class AwtBugDemonstrator extends Application {
	
	@Override
	public void start(Stage primaryStage) {
		try {		
			primaryStage.setTitle("Awt Bug Demonstrator");	
			BorderPane bp = new BorderPane();
			Scene scene = new Scene(bp, 400, 400);
			
			SwingNode sn = new SwingNode();
			ChartPanel c = new ChartSample().getPanel();
			
			try {
			SwingUtilities.invokeAndWait(
				()->{
						// hangs inside here...
						sn.setContent(c);
					}
			);
			} catch (Exception ex) {
				ex.printStackTrace();
			}
			
			bp.setCenter(sn);	
			primaryStage.setScene(scene);
			primaryStage.show();		
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		launch(args);
	}

	//public class LineChartDemo6 extends ApplicationFrame {
	public class ChartSample  {
		ChartPanel chartPanel;
	    public ChartSample() {

	        final XYDataset dataset = createDataset();
	        final JFreeChart chart = createChart(dataset);
	        chartPanel = new ChartPanel(chart);
	        chartPanel.setPreferredSize(new java.awt.Dimension(400, 400));

	    }
	    
	    public ChartPanel getPanel() {
	    	return chartPanel;
	    }
	    
	    private XYDataset createDataset() {
	        
	        final XYSeries series1 = new XYSeries("First");
	        series1.add(1.0, 1.0);
	        final XYSeriesCollection dataset = new XYSeriesCollection();
	        dataset.addSeries(series1);                
	        return dataset;
	        
	    }
	
	    private JFreeChart createChart(final XYDataset dataset) {
	        
	        final JFreeChart chart = ChartFactory.createXYLineChart(
	            "Bug Demonstrator",   "X",    "Y",   dataset,             
	            PlotOrientation.VERTICAL,true, true, false    
	        );

	        final XYPlot plot = chart.getXYPlot();
	        
	        final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
	        plot.setRenderer(renderer);
	        
	        return chart;
	        
	    }
	}

}

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

CUSTOMER SUBMITTED WORKAROUND :
None that i'm aware of - i wish there were.


Comments
Then it works. Will send an email to the submitter to verify it on 8u20 and updated testcase.
04-07-2014

This is a bug in the test. The following is illegal: at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1348) at demo.AwtBugDemonstrator.start(AwtBugDemonstrator.java:34) because AndWait() blocks the execution, and user code is not allowed to block an event thread (be it an FX or AWT event thread). The test should use invokeLater() instead.
04-07-2014

In the latest jdkI get simple deadlock: "JavaFX Application Thread" #15 prio=5 os_prio=31 tid=0x00007fb334093800 nid=0x1007 in Object.wait() [0x00007fff5a281000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x000000076d9a2e08> (a java.awt.EventQueue$1AWTInvocationLock) at java.lang.Object.wait(Object.java:502) at java.awt.EventQueue.invokeAndWait(EventQueue.java:1300) - locked <0x000000076d9a2e08> (a java.awt.EventQueue$1AWTInvocationLock) at java.awt.EventQueue.invokeAndWait(EventQueue.java:1281) at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1348) at demo.AwtBugDemonstrator.start(AwtBugDemonstrator.java:34) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$26(LauncherImpl.java:821) at com.sun.javafx.application.LauncherImpl$$Lambda$50/1489295267.run(Unknown Source) at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$38(PlatformImpl.java:319) at com.sun.javafx.application.PlatformImpl$$Lambda$46/797914860.run(Unknown Source) at com.sun.javafx.application.PlatformImpl.lambda$null$36(PlatformImpl.java:288) at com.sun.javafx.application.PlatformImpl$$Lambda$48/1023013294.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$37(PlatformImpl.java:287) at com.sun.javafx.application.PlatformImpl$$Lambda$47/1402934144.run(Unknown Source) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) "AWT-EventQueue-0" #20 prio=6 os_prio=31 tid=0x00007fb338a94800 nid=0xc903 runnable [0x000000012acf5000] java.lang.Thread.State: RUNNABLE at sun.lwawt.macosx.CCursorManager.nativeGetCursorPosition(Native Method) at sun.lwawt.macosx.CCursorManager.getCursorPosition(CCursorManager.java:54) at sun.lwawt.LWMouseInfoPeer.fillPointWithCoords(LWMouseInfoPeer.java:41) at java.awt.MouseInfo.getPointerInfo(MouseInfo.java:84) at sun.swing.JLightweightFrame.updateClientCursor(JLightweightFrame.java:478) at sun.swing.JLightweightFrame.access$000(JLightweightFrame.java:74) at sun.swing.JLightweightFrame$1.updateCursor(JLightweightFrame.java:107) at sun.lwawt.LWLightweightFramePeer.updateCursorImmediately(LWLightweightFramePeer.java:118) at java.awt.Component.updateCursorImmediately(Component.java:3151) at java.awt.Component.show(Component.java:1640) - locked <0x000000076d651608> (a java.awt.Component$AWTTreeLock) at java.awt.Window.show(Window.java:1042) at java.awt.Component.show(Component.java:1665) at java.awt.Component.setVisible(Component.java:1617) at java.awt.Window.setVisible(Window.java:1014) at javafx.embed.swing.SwingNode.setContentImpl(SwingNode.java:266) at javafx.embed.swing.SwingNode.lambda$setContent$1(SwingNode.java:177) at javafx.embed.swing.SwingNode$$Lambda$167/1498084703.run(Unknown Source) at javafx.embed.swing.SwingFXUtils.runOnEDT(SwingFXUtils.java:221) at javafx.embed.swing.SwingNode.setContent(SwingNode.java:176) at demo.AwtBugDemonstrator.lambda$start$1(AwtBugDemonstrator.java:37) at demo.AwtBugDemonstrator$$Lambda$166/366547711.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744) at java.awt.EventQueue.access$400(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:697) at java.awt.EventQueue$3.run(EventQueue.java:691) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.awt.EventQueue.dispatchEvent(EventQueue.java:714) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) We acquire a treelock on appkit.
04-07-2014

This code was removed in JDK-8027778 in 8u20. I will close CR after additional check.
04-07-2014

Sergey and/or Petr were the last to touch this code.
04-07-2014

probably related to JDK-7200762
04-07-2014