Bug 551 - JOGL runs fine in Eclipse but crashes when running a deployed version on windows 7. On Windows XP everything is fine
Summary: JOGL runs fine in Eclipse but crashes when running a deployed version on wind...
Status: RESOLVED INVALID
Alias: None
Product: Jogl
Classification: JogAmp
Component: opengl (show other bugs)
Version: 2
Hardware: pc_x86_64 windows
: --- normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2012-01-09 15:32 CET by ralf.buchbach
Modified: 2012-01-23 02:20 CET (History)
1 user (show)

See Also:
Type: ---
SCM Refs:
Workaround: ---


Attachments
Debug Log Deployed (510.48 KB, text/plain)
2012-01-09 15:35 CET, ralf.buchbach
Details
Debug Log Eclipse (1.67 MB, text/plain)
2012-01-09 15:36 CET, ralf.buchbach
Details
Error Report (14.93 KB, application/octet-stream)
2012-01-09 15:36 CET, ralf.buchbach
Details
Sourcecode of test application (41.92 KB, application/octet-stream)
2012-01-10 08:26 CET, ralf.buchbach
Details
Jar File of test application and start command (20.59 KB, application/octet-stream)
2012-01-10 08:29 CET, ralf.buchbach
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ralf.buchbach 2012-01-09 15:32:03 CET
I have a huge Java Application which contains one frame using JOGL to display some open gl graphics.

On Windows XP the application runs fine. Due to migration to windows 7 the application needs to be ported to windows 7.

When running the application within the Eclipse IDE it works fine. There are no problems concering the JOGL part. 

After that I deployed the application using the same routines that worked for Windows XP (IzPack Installer).
Now the problems begin:
Case 1: Eclipse IDE is open: The deployed application runs fine
Case 2: Eclipse IDE never opened. Assuming fresh boot of the system and starting the application: The deployed application crashes as soon as the JOGL frame is created.

For me, this is a really strange behaviour I cannot comprehend.

I have created a small test project which is a copy of the original application, but contains only the JOGL part. Its nearly the same architecture (MDI, but MVC Pattern is not realised) and took the original classes but reduced the code to a minimum. So this small application runs fine when it is deployed.

My System:
Windows 7 x64 Enterprise
JOGL2 RC5
Nvidia Quadro FX 360M. Driver: 266.58
Java: 1.6U29 / 1.6U30 / 1.7U2

With this bug report i attach three things:
1) Debug Log File Deployed Application
2) Debug Log File in Eclipse
3) A sample error report of VM crash

Perhaps you have an idea an idea where this error is hidden.

BR
Comment 1 ralf.buchbach 2012-01-09 15:35:24 CET
Created attachment 312 [details]
Debug Log Deployed
Comment 2 ralf.buchbach 2012-01-09 15:36:08 CET
Created attachment 313 [details]
Debug Log Eclipse
Comment 3 ralf.buchbach 2012-01-09 15:36:41 CET
Created attachment 314 [details]
Error Report
Comment 5 Julien Gouesse 2012-01-09 16:44:05 CET
I don't know whether it is important but I have noticed this difference between both files, this appears only before JOGL crashes:
"createContextARB: mappedVersionsAvailableSet(decon): false"
not when it works:
"createContextARB: SET mappedVersionsAvailableSet Windows_decon_0"
Comment 6 Sven Gothel 2012-01-09 16:50:18 CET
Interesting .. I read your attachments.

You mentioned to have a small standalone test case, could you attach it here ?

Just for curiosity, can you try w/ latest sources/builds and define
property 'jogl.windows.useWGLVersionOf5WGLGDIFuncSet' ?
  
http://jogamp.org/git/?p=jogl.git;a=commit;h=c49d29784986b1945343b9a90b5e0c9f3d95d937

You have run the JOGL app with 
(1) eclipse and 
(2) special deployment variant (I don't know)

Can you add another one with
(3) standalone / commandline w/ only std method, 
      eg. JAR / classes .. etc
?

However, if I would have your standalone project and your special deployment
tool (2)
maybe I can help.
Comment 7 Sven Gothel 2012-01-09 16:52:15 CET
re: comment 5, you don't see the 'SET' in the crashed version, since it hasn't reached 
the point where all GL versions are queried.
IE the app crashed within our initialization sequence, hence no user code is involved.

But I guess this special deployment thingy (which I don't know) 
must have something to do with it ..
Comment 8 ralf.buchbach 2012-01-10 08:24:18 CET
@Sven:

The "special deployment variant" is just a way to deploy the application to a computer. There is nothing special. I use the IzPack installer to pack the jar-file of the tool and all necessary libraries and .dlls in one single jar file. This jar file behaves like an installer and just copies the content to a user defined folder.

So I could copy everything manually, it would be the same but not that comfortable. Thats the special deployment variant.

I attach the small test project. This is structured like the deployment variant. Also I attache the Eclipse project. But this works fine.

To be sure: The property I define like the debug properties as jvm property so:
jogl.windows.useWGLVersionOf5WGLGDIFuncSet = true , right?

One thing I discovered was, that there were different GL Profiles used.
When it crashes:
AWT-EventQueue-0-SharedResourceRunner - WindowWGLContext.createContextARBImpl: 4.2 (compatibility profile, any, new) - @creation, handle 0x77010e
a4, share 0x0, direct true, wglCreateContextAttribsARB: 0x69c5a660

When it works:
AWT-EventQueue-0-SharedResourceRunner - WindowWGLContext.createContextARBImpl: 3.0 (compatibility profile, any, new) - @creation, handle 0xd012c65, share 0x0, direct true, wglCreateContextAttribsARB: 0x69c5a660
java.lang.Exception: Stack trace
Comment 9 ralf.buchbach 2012-01-10 08:26:16 CET
Created attachment 315 [details]
Sourcecode of test application
Comment 10 ralf.buchbach 2012-01-10 08:29:53 CET
Created attachment 316 [details]
Jar File of test application and start command
Comment 11 ralf.buchbach 2012-01-12 08:23:31 CET
Finally I managed the application to start with the parameter and latest builds
JOGL: Build 620
Gluegen: Build 474

I tried the application to run within Eclipse and received following exceptions:
USE_WGLVersion_Of_5WGLGDIFuncSet: true
javax.media.opengl.GLException: WindowsWGLDrawableFactory - Could not initialize shared resources for decon
	at jogamp.opengl.windows.wgl.WindowsWGLDrawableFactory$SharedResourceImplementation.createSharedResource(WindowsWGLDrawableFactory.java:340)
	at jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:261)
	at java.lang.Thread.run(Thread.java:662)
Caused by: javax.media.opengl.GLException: Unable to create temp OpenGL context for device context 0x1001124b
	at jogamp.opengl.windows.wgl.WindowsWGLContext.createImpl(WindowsWGLContext.java:294)
	at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:505)
	at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:424)
	at jogamp.opengl.windows.wgl.WindowsWGLDrawableFactory$SharedResourceImplementation.createSharedResource(WindowsWGLDrawableFactory.java:315)
	... 2 more
Exception occurred during event dispatching:
java.lang.ExceptionInInitializerError
	at gui.frames.openGLFrame.openGLModeFrame.initComponents(openGLModeFrame.java:139)
	at gui.frames.openGLFrame.openGLModeFrame.<init>(openGLModeFrame.java:104)
	at gui.frames.dataObjectFrameSelectorDialog$addButtonListener.actionPerformed(dataObjectFrameSelectorDialog.java:267)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
	at java.awt.Component.processMouseEvent(Component.java:6288)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
	at java.awt.Component.processEvent(Component.java:6053)
	at java.awt.Container.processEvent(Container.java:2041)
	at java.awt.Component.dispatchEventImpl(Component.java:4651)
	at java.awt.Container.dispatchEventImpl(Container.java:2099)
	at java.awt.Component.dispatchEvent(Component.java:4481)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
	at java.awt.Container.dispatchEventImpl(Container.java:2085)
	at java.awt.Window.dispatchEventImpl(Window.java:2478)
	at java.awt.Component.dispatchEvent(Component.java:4481)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
	at java.awt.EventQueue.access$000(EventQueue.java:84)
	at java.awt.EventQueue$1.run(EventQueue.java:602)
	at java.awt.EventQueue$1.run(EventQueue.java:600)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
	at java.awt.EventQueue$2.run(EventQueue.java:616)
	at java.awt.EventQueue$2.run(EventQueue.java:614)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:613)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
	at java.awt.Dialog$1.run(Dialog.java:1046)
	at java.awt.Dialog$3.run(Dialog.java:1098)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.awt.Dialog.show(Dialog.java:1096)
	at java.awt.Component.show(Component.java:1584)
	at java.awt.Component.setVisible(Component.java:1536)
	at java.awt.Window.setVisible(Window.java:842)
	at java.awt.Dialog.setVisible(Dialog.java:986)
	at gui.frames.mainWindow.mainWindowMenuBar$addWidgetActionListener.actionPerformed(mainWindowMenuBar.java:165)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:809)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:850)
	at java.awt.Component.processMouseEvent(Component.java:6288)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
	at java.awt.Component.processEvent(Component.java:6053)
	at java.awt.Container.processEvent(Container.java:2041)
	at java.awt.Component.dispatchEventImpl(Component.java:4651)
	at java.awt.Container.dispatchEventImpl(Container.java:2099)
	at java.awt.Component.dispatchEvent(Component.java:4481)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
	at java.awt.Container.dispatchEventImpl(Container.java:2085)
	at java.awt.Window.dispatchEventImpl(Window.java:2478)
	at java.awt.Component.dispatchEvent(Component.java:4481)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
	at java.awt.EventQueue.access$000(EventQueue.java:84)
	at java.awt.EventQueue$1.run(EventQueue.java:602)
	at java.awt.EventQueue$1.run(EventQueue.java:600)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
	at java.awt.EventQueue$2.run(EventQueue.java:616)
	at java.awt.EventQueue$2.run(EventQueue.java:614)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:613)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: javax.media.opengl.GLException: Profile GL2 is not available on null, but: []
	at javax.media.opengl.GLProfile.get(GLProfile.java:655)
	at javax.media.opengl.GLProfile.get(GLProfile.java:668)
	at gui.widgets.openGlPlot.openGLModePanel.<clinit>(openGLModePanel.java:85)
	... 83 more

The same happens when running outside of Eclipse.

BR
Comment 12 ralf.buchbach 2012-01-13 11:24:34 CET
Update:
I tried some additional and sometimes desperate things to get it to work:

Since the small testcase worked I reduced the JOGL related classes in the complete application the same way they are reduced in the testcase. Did not work

So I thought there might be some incompatibilities with some other libraries I use but could not verify that.

Starting the complete application just with jogl,logging and mysql-jar did not work either.

Also I tried to use a Java7U2 VM again but did not work. In the meantime I got one JavaVM Error Report which says that the failing module was opengl32.dll.

One last thing was, that I copied the necessary .jar's, the logging configuration and the application jar manually to a folder and created the start-command (no installer used) - did not work either.

Overview of used libraries:
JAMA
JMatIO
JFreechart
log4j
MigLayout
GroupLayout
MySQL Java Connector
POI
VTK (But JOGL and VTK frames are not opened at the same time!)

BR
Comment 13 Julien Gouesse 2012-01-17 12:46:50 CET
Hi

Maybe one of your dependencies try to load OpenGL native libraries before JOGL (maybe VTK as it uses OpenGL for its rendering).
Comment 14 ralf.buchbach 2012-01-18 11:56:49 CET
Hi Julien,

I think this can be excluded.

Actually I have tested this in the small application. I have referenced the vtk library without any code that uses VTK and it works. Additionaly, I have referenced JFreeChart, too.

The test application worked.

In the original application this is also the same. When opening the jogl frame there is no code active that loads the vtk libraries. this is another frame which does not exist at the moment.
To verify this I took the original application and deleted everything in the code which is not necesseray for the open gl frame. Unfortunately this very very reduced original application crashes at all and there is no vtk active code.

For me this is a very strange behaviour. The new bottom-up build test application works with jogl but when I take the top-down reduced application (at least the 3 jogl classes contain exactly the same code) jogl does not work?!

@Sven: Have you discovered s.th.?

I guess I will prepare s.th. to attach these both applications to the bug report..

BR
Comment 15 ralf.buchbach 2012-01-19 08:37:20 CET
Good news!

I guess I could localize the concrete problem and fix it. In the initialization of the application there is a check for the graphic environment. This method causes the problem on windows 7.

Since I don't see a important reason to use this check I disabled the call to the function and the OpenGL works fine.

Here is the source code of the method that performs the check and seems to do s.th. that JOGL does not like when running outside of eclipse.

public class graphicsEnvironment {

	static Logger logger = Logger.getLogger(graphicsEnvironment.class.getName());
	
	public static void checkGraphicsEnvironment() {
		Rectangle virtualBounds = new Rectangle();
		GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
	    GraphicsDevice[] gs = ge.getScreenDevices();
	    
	    //write graphics devices to log 
	    logger.info("number of graphics devices " + gs.length);
	    for(int i =0 ; i < gs.length; i++) {
	    	logger.info(gs[i].toString());
	    }
	    
	    //check for bounds
	    for (int j = 0; j < gs.length; j++) { 
	    	GraphicsDevice gd = gs[j];
	        GraphicsConfiguration[] gc = gd.getConfigurations();
	        for (int i=0; i < gc.length; i++) {
	        	logger.info("graphics configuration for device " + j + " is: " + gc[i].getBounds());
	        	virtualBounds = virtualBounds.union(gc[i].getBounds());
	        }	        
	    }
		
	}
	
}

Perhaps you got an idea why this function fails on windows 7 and works fine on windows xp with JOGL.

BR
Comment 16 ralf.buchbach 2012-01-19 08:47:36 CET
Additional Information:

The code is part of the official java documentation
http://docs.oracle.com/javase/6/docs/api/java/awt/GraphicsConfiguration.html
Comment 17 Julien Gouesse 2012-01-19 10:57:37 CET
What happens if you use -Dsun.java2d.opengl=false?
Comment 18 ralf.buchbach 2012-01-19 16:32:49 CET
Using this start command:
"C:\Program Files\Java\jdk1.6.0_29\bin\javaw.exe" -Dsun.java2d.noddraw=true -Dsun.java2d.d3d=false -Dsun.java2d.ddoffscreen=false -Dsun.java2d.gdiblit=false -Dsun.java2d.opengl=false -Xms512m -Xmx1024m -jar "C:\Program Files\Correlation Tool\JOGL2TestB620v12\corr_tool_x64_jogl2b620.jar"

and the checkGraphicsEnvironment mentioned above it crashes again.

IIRC the -Dsun.java2d.opengl=false also causes trouble on windows xp.

BR
Comment 19 ralf.buchbach 2012-01-19 16:34:14 CET
Using this start command:
"C:\Program Files\Java\jdk1.6.0_29\bin\javaw.exe" -Dsun.java2d.noddraw=true -Dsun.java2d.d3d=false -Dsun.java2d.ddoffscreen=false -Dsun.java2d.gdiblit=false -Dsun.java2d.opengl=false -Xms512m -Xmx1024m -jar "C:\Program Files\Correlation Tool\JOGL2TestB620v12\corr_tool_x64_jogl2b620.jar"

and the checkGraphicsEnvironment method mentioned above it crashes again.

IIRC the -Dsun.java2d.opengl=false parameter causes trouble on windows xp, too.

BR
Comment 20 Sven Gothel 2012-01-23 02:20:09 CET
Sounds great - thank you Ralf for identifying this issue and creating a work around.

Validated your findings:
  http://jogamp.org/git/?p=jogl.git;a=commit;h=05dfc0ca320d6578cd596cc3384a3bbc6fc4e36f

+++
Turns out, that the culprit (at least on my Win7 NVidia machine) is
the runtime property "-Dsun.java2d.opengl=false".
When _not_ setting this prop. the test runs fine.
+++

Since it seems this issue is not related or cause by our code, but internals to AWT and/or
the OS/driver, I close it with 'INVALID'.

Please reopen this bug when you see fit.