JOGL crashes with Java7 (Preview Release) on OSX

classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|

JOGL crashes with Java7 (Preview Release) on OSX

andrade
Hi,

I did some tests of JOGL (2.0-RC5) with Java 7, and it seems to work fine on Linux (64bit), Windows7 (32bit), but it crashes on Mac OSX (10.6.8 and also 10.7)

Note that, for OSX, I used the "Oracle JDK7 Mac OS X Port Developer Preview Release" since there's not yet a final release for this platform ( http://jdk7.java.net/macportpreview/ )

Exception in thread "main" java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at javax.media.nativewindow.NativeWindowFactory$1.run(NativeWindowFactory.java:218)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.media.nativewindow.NativeWindowFactory.initSingleton(NativeWindowFactory.java:215)
        at javax.media.opengl.GLProfile.initProfilesForDefaultDevices(GLProfile.java:1214)
        at javax.media.opengl.GLProfile.access$000(GLProfile.java:75)
        at javax.media.opengl.GLProfile$1.run(GLProfile.java:133)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.media.opengl.GLProfile.initSingleton(GLProfile.java:122)
        at javax.media.opengl.GLProfile.initSingleton(GLProfile.java:151)
        at javax.media.opengl.GLProfile.getProfileMap(GLProfile.java:1688)
        at javax.media.opengl.GLProfile.get(GLProfile.java:652)
        at javax.media.opengl.GLProfile.getDefault(GLProfile.java:478)
        at javax.media.opengl.GLProfile.getDefault(GLProfile.java:486)
        at agile2d.examples.HelloWorld.main(HelloWorld.java:35)
Caused by: java.lang.RuntimeException: Unable to initialize JAWT: 0x10004
        at jogamp.nativewindow.jawt.JAWT$1.run(JAWT.java:123)
        at jogamp.nativewindow.jawt.JAWT$1.run(JAWT.java:108)
        at java.security.AccessController.doPrivileged(Native Method)
        at jogamp.nativewindow.jawt.JAWT.getJAWT(JAWT.java:108)
        at jogamp.nativewindow.jawt.JAWTUtil.getJAWT(JAWTUtil.java:105)
        at jogamp.nativewindow.jawt.JAWTUtil.<clinit>(JAWTUtil.java:125)

I attached the test and test_dbg log files to this post.

Maybe this crash is related to the "Non-Features" described in the "Port status pages":
https://wikis.oracle.com/display/OpenJDK/Mac+OS+X+Port+Project+Status
"These features will not be ported to OpenJDK from the Apple Java SE 6 port
(…)
    .NSView-based JAWT embedding
        .CALayer embedding instead
(…)"

Log files:
test.log
test_dbg.log
--
Rodrigo Andrade de Almeida
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

Sven Gothel
Administrator
On Friday, January 13, 2012 02:43:48 PM andrade [via jogamp] wrote:

>
> Hi,
>
> I did some tests of JOGL (2.0-RC5) with Java 7, and it seems to work fine on
> Linux (64bit), Windows7 (32bit), but it crashes on Mac OSX (10.6.8 and also
> 10.7)
>
> Note that, for OSX, I used the "Oracle JDK7 Mac OS X Port Developer Preview
> Release" since there's not yet a final release for this platform (
> http://jdk7.java.net/macportpreview/ )

</snip>

>
> Caused by: java.lang.RuntimeException: Unable to initialize JAWT: 0x10004
> at jogamp.nativewindow.jawt.JAWT$1.run(JAWT.java:123)
>
> I attached the test and test_dbg log files to this post.
>
> Maybe this crash is related to the "Non-Features" described in the "Port
> status pages":
> https://wikis.oracle.com/display/OpenJDK/Mac+OS+X+Port+Project+Status
> "These features will not be ported to OpenJDK from the Apple Java SE 6 port
> (…)
>     .NSView-based JAWT embedding
>         .CALayer embedding instead
> (…)"

Thanks Andrade for the heads up!

Yup, maybe we need to adapt to this situation,
and check whether and how we can use CALayer embedding.
It's definetly related, sure.

~Sven

>
> Log files:
> http://forum.jogamp.org/file/n3656684/test.log test.log
> http://forum.jogamp.org/file/n3656684/test_dbg.log test_dbg.log
>
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

gouessej
Administrator
In reply to this post by andrade
Does it affect NEWT too?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

Sven Gothel
Administrator
On Friday, January 13, 2012 03:11:19 PM gouessej [via jogamp] wrote:
>
> Does it affect NEWT too?

No. Only AWT, if backing layer is enabled: Applets or manual selection.
In case it is related to the CALayer API ..

On a 2nd look ..

<agile2d.examples.HelloWorld.main(HelloWorld.java:35)>
is not an Applet etc .. the JAWT version bits
'JAWT_MACOSX_USE_CALAYER' 0x80000000 are not selected.

'Unable to initialize JAWT: 0x10004', indeed says so,
just using JAWT_VERSION_1_4. No CALayer code involved here.

JAWT:
            if (!JAWTFactory.JAWT_GetAWT(jawt)) {
              throw new RuntimeException("Unable to initialize JAWT: 0x"+Integer.toHexString(jawt_version_flags_mod));
            }

native:    jboolean _res = JAWT_GetAWT(env, (JAWT *) _awt_ptr); return _res;


So somehow we cannot even get the 1.4 version JAWT instance here.


~Sven
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

Sven Gothel
Administrator
In reply to this post by gouessej
On Friday, January 13, 2012 03:11:19 PM gouessej [via jogamp] wrote:
>
> Does it affect NEWT too?
>

1nd answer .. if you go AWT headless or at least w/o AWT in JOGL,
the JAWT could wouldn't get triggered.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

gouessej
Administrator
Thanks. I assume that if you use the AWT toolkit to get the screen size, you will reproduce this problem :s
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

Sven Gothel
Administrator
On Friday, January 13, 2012 03:58:23 PM gouessej [via jogamp] wrote:
>
> Thanks. I assume that if you use the AWT toolkit to get the screen size, you
> will reproduce this problem :s

If JAWT is included, it gets initialized.

Well, if you use NEWT, pls use ScreenMode API.

Works for OSX now as well, currently fixing a performance issue.

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

andrade
In reply to this post by Sven Gothel
Sven Gothel wrote
On Friday, January 13, 2012 03:11:19 PM gouessej [via jogamp] wrote:
>
> Does it affect NEWT too?
It crashed the same way when I tested it using a NEWT GLWindow.
--
Rodrigo Andrade de Almeida
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

gouessej
Administrator
@Andrade Do you get exactly the same stack trace with GLWindow?

@Sven How can I get the screen size before creating any GLWindow? If I use the first screen returned by Screen.getAllScreens(), am I sure to get the primary screen?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

Sven Gothel
Administrator
On Friday, January 13, 2012 04:20:37 PM gouessej [via jogamp] wrote:
>
> @Andrade Do you get exactly the same stack trace with GLWindow?

And w/ using jogl.all-noawt.jar ..
>
> @Sven How can I get the screen size before creating any GLWindow? If I use
> the first screen returned by Screen.getAllScreens(), am I sure to get the
> primary screen?
>
http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00NEWT.java;hb=HEAD#l97

Then I would use the same instance for GLWindow creation,
and remove the reference (added for ScreenMode) right after.

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

gouessej
Administrator
Ok I will do it that way:

Display dpy = NewtFactory.createDisplay(null);
Screen screen = NewtFactory.createScreen(dpy, 0);
screen.addReference();
final int screenWidth = screen.getWidth();
final int screenHeight = screen.getHeight();
screen.removeReference();

Should I destroy the display too? I assume I have to call these lines of code on a particular thread.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

andrade
In reply to this post by Sven Gothel
Sven Gothel wrote
On Friday, January 13, 2012 04:20:37 PM gouessej [via jogamp] wrote:
>
> @Andrade Do you get exactly the same stack trace with GLWindow?

And w/ using jogl.all-noawt.jar ..
Ok, I'm not sure if my test is good, but using jogl.all-noawt.jar, it doesn't crash the same way:

2012-01-13 16:57:36.174 java[2029:903] *** __NSAutoreleaseNoPool(): Object 0x118201010 of class __NSCFDate autoreleased with no pool in place - just leaking
2012-01-13 16:57:36.179 java[2029:903] *** __NSAutoreleaseNoPool(): Object 0x1182078e0 of class NSCFTimer autoreleased with no pool in place - just leaking
Exception in thread "main" java.lang.RuntimeException: java.lang.NoClassDefFoundError: javax/media/opengl/awt/GLCanvas
        at jogamp.newt.DefaultEDTUtil.invokeImpl(DefaultEDTUtil.java:189)
        at jogamp.newt.DefaultEDTUtil.invoke(DefaultEDTUtil.java:122)
        at jogamp.newt.DisplayImpl.runOnEDTIfAvail(DisplayImpl.java:191)
        at jogamp.newt.WindowImpl.runOnEDTIfAvail(WindowImpl.java:1558)
        at jogamp.newt.WindowImpl.setVisible(WindowImpl.java:769)
        at com.jogamp.newt.opengl.GLWindow.setVisible(GLWindow.java:337)
        at agile2d.examples.HelloWorldGLWindow.main(HelloWorldGLWindow.java:28)
Caused by: java.lang.NoClassDefFoundError: javax/media/opengl/awt/GLCanvas
        at agile2d.examples.AgileExample.display(AgileExample.java:69)
        at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:182)
        at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:170)
        at com.jogamp.newt.opengl.GLWindow$DisplayAction.run(GLWindow.java:646)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:398)
        at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:572)
        at com.jogamp.newt.opengl.GLWindow$1.windowResized(GLWindow.java:92)
        at jogamp.newt.WindowImpl.consumeWindowEvent(WindowImpl.java:2230)
        at jogamp.newt.WindowImpl.sendWindowEvent(WindowImpl.java:2173)
        at jogamp.newt.WindowImpl.setVisibleActionImpl(WindowImpl.java:750)
        at jogamp.newt.WindowImpl$VisibleAction.run(WindowImpl.java:761)
        at com.jogamp.common.util.RunnableTask.run(RunnableTask.java:128)
        at jogamp.newt.DefaultEDTUtil$EventDispatchThread.run(DefaultEDTUtil.java:295)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.awt.GLCanvas
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        ... 13 more
--
Rodrigo Andrade de Almeida
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

gouessej
Administrator
Where can I download this version of Agile2D? I found only the old one relying on the previous Java binding of the OpenGL API written by Sven and called "GL4Java". When will it be officially released? I would like to use it with JFreeChart.

Are you sure you removed all references to GLCanvas?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

Sven Gothel
Administrator
In reply to this post by gouessej
On Friday, January 13, 2012 04:56:58 PM gouessej [via jogamp] wrote:

>
> Ok I will do it that way:
>
> Display dpy = NewtFactory.createDisplay(null);
> Screen screen = NewtFactory.createScreen(dpy, 0);
> screen.addReference();
> final int screenWidth = screen.getWidth();
> final int screenHeight = screen.getHeight();
> screen.removeReference();
>
> Should I destroy the display too? I assume I have to call these lines of
> code on a particular thread.

addReference calls are ofc chained:
  window -> screen -> display

yup, haven't explicitly mentioned this in the API doc.

So the unit test is right w/ only calling:
  screen.removeReference();

You can avoid create.destroy.create by:

> Display dpy = NewtFactory.createDisplay(null);
> Screen screen = NewtFactory.createScreen(dpy, 0);
> screen.addReference();
> final int screenWidth = screen.getWidth();
> final int screenHeight = screen.getHeight();
+ GLWindow win = GLWindow.create(screen, caps);
+ win.setVisible(true);
> screen.removeReference();

Meaning Screen.addReference() is called by NEWT Window
lazily .. when it's needed, ie at setVisible(true).

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

Sven Gothel
Administrator
In reply to this post by andrade
On Friday, January 13, 2012 04:58:59 PM andrade [via jogamp] wrote:

>
> Sven Gothel wrote
> >
> > On Friday, January 13, 2012 04:20:37 PM gouessej [via jogamp] wrote:
> >>
> >> @Andrade Do you get exactly the same stack trace with GLWindow?
> >
> > And w/ using jogl.all-noawt.jar ..
> >
>
> Ok, I'm not sure if my test is good, but using jogl.all-noawt.jar, it
> doesn't crash the same way:

Ofc .. you cannot use GLCanvas based on AWT w/o having 'loaded' our AWT parts,
hence jogl.all-noawt.jar. You would need to use NEWT for that. Sorry.

Where can I get this OpenJDK7 version to test with ?

~Sven

>
> 2012-01-13 16:57:36.174 java[2029:903] *** __NSAutoreleaseNoPool(): Object
> 0x118201010 of class __NSCFDate autoreleased with no pool in place - just
> leaking
> 2012-01-13 16:57:36.179 java[2029:903] *** __NSAutoreleaseNoPool(): Object
> 0x1182078e0 of class NSCFTimer autoreleased with no pool in place - just
> leaking
> Exception in thread "main" java.lang.RuntimeException:
> java.lang.NoClassDefFoundError: javax/media/opengl/awt/GLCanvas
> at jogamp.newt.DefaultEDTUtil.invokeImpl(DefaultEDTUtil.java:189)
> at jogamp.newt.DefaultEDTUtil.invoke(DefaultEDTUtil.java:122)
> at jogamp.newt.DisplayImpl.runOnEDTIfAvail(DisplayImpl.java:191)
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

andrade
>Where can I download this version of Agile2D? I found only the old one relying on the previous Java binding of the
>OpenGL API written by Sven and called "GL4Java". When will it be officially released? I would like to use it with
>JFreeChart.

It's under development and but a release is planned for next monday (the 16th).
I'll post the link here ;)


Sven Gothel wrote
Where can I get this OpenJDK7 version to test with ?
Here:
http://jdk7.java.net/macportpreview/
--
Rodrigo Andrade de Almeida
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

gouessej
Administrator
Thanks. I'm impatient to give it a try. It would be nice as a tool to port APIs depending on Java2D/AWT to JOGL/NEWT. Maybe we could use it to create a JOGL backend for PureSwing :)
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

gouessej
Administrator
In reply to this post by andrade
Hi

I have found your beta version:
http://sourceforge.net/projects/agile2d/
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

Sven Gothel
Administrator
In reply to this post by andrade
On Friday, January 13, 2012 02:43:48 PM andrade [via jogamp] wrote:

>
> Hi,
>
> I did some tests of JOGL (2.0-RC5) with Java 7, and it seems to work fine on
> Linux (64bit), Windows7 (32bit), but it crashes on Mac OSX (10.6.8 and also
> 10.7)
>
> Note that, for OSX, I used the "Oracle JDK7 Mac OS X Port Developer Preview
> Release" since there's not yet a final release for this platform (
> http://jdk7.java.net/macportpreview/ )
>

...

>
> Maybe this crash is related to the "Non-Features" described in the "Port
> status pages":
> https://wikis.oracle.com/display/OpenJDK/Mac+OS+X+Port+Project+Status
> "These features will not be ported to OpenJDK from the Apple Java SE 6 port
> (…)
>     .NSView-based JAWT embedding
>         .CALayer embedding instead
> (…)"
>

Now this makes sense .. sorry for the confusion.

So my below posting was written with inverted logic :)

I guess the Wiki's meaning is:
  - No NSView/Cocoa based JAWT binding (0x10004), but
  - Only CALayer based JAWT binding (0x80010004) !

I guess we can manage that, ie enforce CALayer use w/ Java7
or at least try it as a last resort :)

Will try this after OS X 10.5 fix ..

~Sven

On Friday, January 13, 2012 03:41:24 PM Sven Gothel wrote:

> On Friday, January 13, 2012 03:11:19 PM gouessej [via jogamp] wrote:
> >
> > Does it affect NEWT too?
>
> No. Only AWT, if backing layer is enabled: Applets or manual selection.
> In case it is related to the CALayer API ..
>
> On a 2nd look ..
>
> <agile2d.examples.HelloWorld.main(HelloWorld.java:35)>
> is not an Applet etc .. the JAWT version bits
> 'JAWT_MACOSX_USE_CALAYER' 0x80000000 are not selected.
>
> 'Unable to initialize JAWT: 0x10004', indeed says so,
> just using JAWT_VERSION_1_4. No CALayer code involved here.
>
> JAWT:
>             if (!JAWTFactory.JAWT_GetAWT(jawt)) {
>               throw new RuntimeException("Unable to initialize JAWT: 0x"+Integer.toHexString(jawt_version_flags_mod));
>             }
>
> native:    jboolean _res = JAWT_GetAWT(env, (JAWT *) _awt_ptr); return _res;
>
>
> So somehow we cannot even get the 1.4 version JAWT instance here.
>
>
> ~Sven
>
Reply | Threaded
Open this post in threaded view
|

Re: JOGL crashes with Java7 (Preview Release) on OSX

Sven Gothel
Administrator
In reply to this post by andrade
On 01/20/2012 02:09 AM, Sven Gothel wrote:

>
> Now this makes sense .. sorry for the confusion.
>
> So my below posting was written with inverted logic :)
>
> I guess the Wiki's meaning is:
>   - No NSView/Cocoa based JAWT binding (0x10004), but
>   - Only CALayer based JAWT binding (0x80010004) !
>
> I guess we can manage that, ie enforce CALayer use w/ Java7
> or at least try it as a last resort :)
>
> Will try this after OS X 10.5 fix ..
Fixed and manually tested w/
jdk-7u4-ea-bin-b11-macosx-amd64-09_feb_2012.dmg


>
> ~Sven


signature.asc (910 bytes) Download Attachment
12