Bug 1500

Summary: Simple Hello World crashes on macOS 14.4 beta
Product: [JogAmp] Jogl Reporter: Stéphane Mottelet <stephane.mottelet>
Component: macosxAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P4    
Version: 2.5.0   
Hardware: All   
OS: macosx   
Type: DEFECT SCM Refs:
Workaround: ---
Attachments: stacktrace

Description Stéphane Mottelet 2024-02-07 15:21:10 CET
Simple HelloWorld program

import com.jogamp.opengl.*;    
import com.jogamp.opengl.awt.GLCanvas;   
import javax.swing.JFrame;    
        
public class HelloWorld implements GLEventListener {    
        
	@Override    
	public void init(GLAutoDrawable arg0)     
	{    
                
	}    
        
	@Override    
	public void display(GLAutoDrawable drawable) {    
		final GL2 gl = drawable.getGL().getGL2();    
		//Draw H  
		gl.glBegin(GL2.GL_LINES);   
		gl.glVertex2d(-0.8, 0.6);  
		gl.glVertex2d(-0.8, -0.6);  
		gl.glVertex2d(-0.8, 0.0);  
		gl.glVertex2d(-0.4, 0.0);  
		gl.glVertex2d(-0.4, 0.6);  
		gl.glVertex2d(-0.4, -0.6);
		gl.glEnd();  
		//Draw W  
		gl.glBegin(GL2.GL_LINES);  
		gl.glVertex2d(0.4,0.6);  
		gl.glVertex2d(0.4,-0.6);  
		gl.glVertex2d(0.4,-0.6);  
		gl.glVertex2d(0.6,0);  
		gl.glVertex2d(0.6,0);  
		gl.glVertex2d(0.8,-0.6);  
		gl.glVertex2d(0.8,-0.6);  
		gl.glVertex2d(0.8,0.6);  
		gl.glEnd();  
	}          
	@Override    
	public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4)     
	{        
        
	}    
	@Override    
	public void dispose(GLAutoDrawable arg0)     
	{    
        
	}    
        
	public static void main(String[] args) {    
        
		final GLProfile gp = GLProfile.get(GLProfile.GL2);    
		GLCapabilities cap = new GLCapabilities(gp);    
        
		final GLCanvas gc = new GLCanvas(cap);    
		HelloWorld sq = new HelloWorld();    
		gc.addGLEventListener(sq);    
		gc.setSize(400, 400);    
        
		final JFrame frame = new JFrame("Hello World");    
		frame.add(gc);    
		frame.setSize(500,400);    
		frame.setVisible(true);      
	}        
} 

crashes with the following stacktrace under macOS 14.4 beta:

Thread 1 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x0000000000000000
    x4: 0x0000000000000000   x5: 0x0000000000000000   x6: 0x0000000000000000   x7: 0x0000000000000000
    x8: 0x33303aa2bf3400a8   x9: 0x33303aa2bf3400a8  x10: 0x0000000000000025  x11: 0x0000000000000001
   x12: 0x000000016d7a95c2  x13: 0x0000000000000000  x14: 0x0000000102e787e9  x15: 0x0000000207c5c5b0
   x16: 0xfffffffffffffff4  x17: 0x0000000211f42c48  x18: 0x0000000000000000  x19: 0x000000016d7a98a8
   x20: 0x000060000290e8c0  x21: 0x0000600003ce5120  x22: 0x0000000000000003  x23: 0x0000000277b7e040
   x24: 0x0000000000000273  x25: 0x0000000000000001  x26: 0x0000000000000000  x27: 0x0000000000000000
   x28: 0x0000000207c96b50   fp: 0x000000016d7a9890   lr: 0x040f0001a439d394
    sp: 0x000000016d7a97c0   pc: 0x00000001a439d394 cpsr: 0x60001000
   far: 0x0000000000000000  esr: 0xf2000001 (Breakpoint) brk 1

Binary Images:
       0x14fa60000 -        0x14facbfff com.apple.AppleMetalOpenGLRenderer (1.0) <8b69c871-19c2-3d46-b8de-8dbc62e532cd> /System/Library/Extensions/AppleMetalOpenGLRenderer.bundle/Contents/MacOS/AppleMetalOpenGLRenderer
       0x121d30000 -        0x121d6bfff libjogl_mobile.dylib (*) <9c3ef505-8828-36ab-a776-5ffdb9d4cd79> /Applications/scilab-2024.0.0.app/Contents/lib/thirdparty/libjogl_mobile.dylib
       0x3136cc000 -        0x313747fff libjogl_desktop.dylib (*) <543b42ae-90a4-325c-8850-84951b1fa6ee> /Applications/scilab-2024.0.0.app/Contents/lib/thirdparty/libjogl_desktop.dylib
       0x121d18000 -        0x121d1ffff libnativewindow_macosx.dylib (*) <2c256988-735b-38b7-9712-0bfc58c3ff90> /Applications/scilab-2024.0.0.app/Contents/lib/thirdparty/libnativewindow_macosx.dylib
       0x107f70000 -        0x107f73fff libnativewindow_awt.dylib (*) <f01b5bf6-6e12-3013-a19d-9a371d95fb5c> /Applications/scilab-2024.0.0.app/Contents/lib/thirdparty/libnativewindow_awt.dylib
       0x107f58000 -        0x107f5bfff libjawt.dylib (*) <5784ddd5-63d7-392c-9952-937b221dcf58> /Library/Java/JavaVirtualMachines/temurin-17.jre/Contents/Home/lib/libjawt.dylib
       0x107e98000 -        0x107e9bfff libgluegen_rt.dylib (*) <c7d0a72d-9862-32a8-b02f-66b24145a27f> /Applications/scilab-2024.0.0.app/Contents/lib/thirdparty/libgluegen_rt.dylib
       0x107e2c000 -        0x107e33fff libosxui.dylib (*) <7c68617d-9c76-3838-9452-787cd3d921b2> /Library/Java/JavaVirtualMachines/temurin-17.jre/Contents/Home/lib/libosxui.dylib 

Problems seems to be in the way Metal framework is used. See also

https://www.astropixelprocessor.com/community/macos/app-not-starting-sonoma-14-4-tried-beta-28-and-29-test-but-no-joy/
https://www.astropixelprocessor.com/community/release-information/astro-pixel-processor-2-0-0-beta28-release-notes/
https://youtrack.jetbrains.com/issue/JBR-6180

Seems that disabling metal at compilation could fix the problem.
Comment 1 Stéphane Mottelet 2024-02-07 15:24:40 CET
Created attachment 887 [details]
stacktrace
Comment 2 Stéphane Mottelet 2024-02-12 10:12:15 CET
It has been fixed by Apple in latest 14.4 beta (23E5191e, 7/2/2024).