PX4 / jMAVSim

Simple multirotor simulator with MAVLink protocol support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash with macOS and Java 9

julianoes opened this issue · comments

On macOS with Java 9 we get the follow segfault:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by javax.media.j3d.JoglPipeline (rsrc:j3dcore.jar) to method sun.awt.AppContext.getAppContext()
WARNING: Please consider reporting this to the maintainers of javax.media.j3d.JoglPipeline
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00000001096ac0cc, pid=62391, tid=775
#
# JRE version: Java(TM) SE Runtime Environment (9.0+11) (build 9.0.4+11)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (9.0.4+11, mixed mode, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# C  [libosxapp.dylib+0x20cc]  -[NSApplicationAWT sendEvent:]+0x179
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/julianoes/src/Firmware/Tools/jMAVSim/out/production/hs_err_pid62391.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
/Users/julianoes/src/Firmware/Tools/jmavsim_run.sh: line 47: 62391 Abort trap: 6           java -XX:GCTimeRatio=20 -Djava.ext.dirs= -jar jmavsim_run.jar $device $extra_args
Options parsed, starting Sim.
Starting GUI...
3D [dev] 1.6.0-pre12-daily-experimental daily

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by javax.media.j3d.JoglPipeline (rsrc:j3dcore.jar) to method sun.awt.AppContext.getAppContext()
WARNING: Please consider reporting this to the maintainers of javax.media.j3d.JoglPipeline
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000010f8730cc, pid=62393, tid=775
#
# JRE version: Java(TM) SE Runtime Environment (9.0+11) (build 9.0.4+11)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (9.0.4+11, mixed mode, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# C  [libosxapp.dylib+0x20cc]  -[NSApplicationAWT sendEvent:]+0x179
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/julianoes/src/Firmware/Tools/jMAVSim/out/production/hs_err_pid62393.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
---------------  S U M M A R Y ------------

Command Line: -XX:GCTimeRatio=20 -Djava.ext.dirs= jmavsim_run.jar -udp 127.0.0.1:14560 -r 500

Host: MacBookPro12,1 x86_64 2700 MHz, 4 cores, 8G, Darwin 17.7.0
Time: Thu Sep 13 11:18:10 2018 CEST elapsed time: 6 seconds (0d 0h 0m 6s)

---------------  T H R E A D  ---------------

Current thread (0x00007f838098e800):  JavaThread "AppKit Thread" daemon [_thread_in_native, id=775, stack(0x00007ffee61b5000,0x00007ffeea1b4000)]

Stack: [0x00007ffee61b5000,0x00007ffeea1b4000],  sp=0x00007ffeea1b1430,  free space=65521k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libosxapp.dylib+0x20cc]  -[NSApplicationAWT sendEvent:]+0x179
C  [AppKit+0x368b5]  -[NSApplication run]+0x32c
C  [libosxapp.dylib+0x1d3a]  +[NSApplicationAWT runAWTLoopWithApp:]+0x9d
C  [libawt_lwawt.dylib+0x3a544]  +[AWTStarter starter:headless:]+0x342
C  [JavaNativeFoundation+0x6f4a]  +[JNFRunLoop _performCopiedBlock:]+0x11
C  [Foundation+0x682b5]  __NSThreadPerformPerform+0x14e
C  [CoreFoundation+0xa3a11]  __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__+0x11
C  [CoreFoundation+0x15d42c]  __CFRunLoopDoSource0+0x6c
C  [CoreFoundation+0x86470]  __CFRunLoopDoSources0+0xd0
C  [CoreFoundation+0x858ed]  __CFRunLoopRun+0x50d
C  [CoreFoundation+0x85153]  CFRunLoopRunSpecific+0x1e3
C  [java+0x6b2e]  CreateExecutionEnvironment+0x35c
C  [java+0x2c65]  JLI_Launch+0x5a9
C  [java+0x1b62]  main+0x186
C  [java+0x19d4]  start+0x34
C  0x0000000000000009


siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000010

Register to memory mapping:

RAX=0x0000000000000000 is an unknown value
RBX=0x0000000000000000 is an unknown value
RCX=0x000000000021e000 is an unknown value
RDX=0x000000000021e000 is an unknown value
RSP=0x00007ffeea1b1430 is pointing into the stack for thread: 0x00007f838098e800
RBP=0x00007ffeea1b1460 is pointing into the stack for thread: 0x00007f838098e800
RSI=0x00007fff2d51d1e5: .str.41.llvm.C4DC25C8+0x4a728 in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit at 0x00007fff2c83c000
RDI=0x0000000000000000 is an unknown value
R8 =0x00000000000000ff is an unknown value
R9 =0x00007f8384944d00 is an unknown value
R10=0x00efdc0100ef4600 is an unknown value
R11=0x00007fff2c9e8817: -[NSEvent data1]+0 in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit at 0x00007fff2c83c000
R12=0x00007f8384944d00 is an unknown value
R13=0x00007f83807e82c0 is an unknown value
R14=0x00007fff564fbe80: objc_msgSend+0 in /usr/lib/libobjc.A.dylib at 0x00007fff564f5000
R15=0x00007f8380538520 is an unknown value


Registers:
RAX=0x0000000000000000, RBX=0x0000000000000000, RCX=0x000000000021e000, RDX=0x000000000021e000
RSP=0x00007ffeea1b1430, RBP=0x00007ffeea1b1460, RSI=0x00007fff2d51d1e5, RDI=0x0000000000000000
R8 =0x00000000000000ff, R9 =0x00007f8384944d00, R10=0x00efdc0100ef4600, R11=0x00007fff2c9e8817
R12=0x00007f8384944d00, R13=0x00007f83807e82c0, R14=0x00007fff564fbe80, R15=0x00007f8380538520
RIP=0x00000001096ac0cc, EFLAGS=0x0000000000010246, ERR=0x0000000000000004
  TRAPNO=0x000000000000000e

Top of Stack: (sp=0x00007ffeea1b1430)
0x00007ffeea1b1430:   00007ffeea1b1450 ffff807c7b6bb300
0x00007ffeea1b1440:   00007fff564fbe80 00007fff564fbe80
0x00007ffeea1b1450:   0000000000000001 00007f8380538520
0x00007ffeea1b1460:   00007ffeea1b1510 00007fff2c8728b5
0x00007ffeea1b1470:   00007fff2d516211 00007f8380538520
0x00007ffeea1b1480:   00007fff2d50eee0 00007fff2d5170fe
0x00007ffeea1b1490:   00007fff893f9178 00007fff2d50db3d
0x00007ffeea1b14a0:   00007fff2d50d813 0000000000000010
0x00007ffeea1b14b0:   00007fff2d50d003 00007fff2d51d1eb
0x00007ffeea1b14c0:   00007fff2d50ce91 00007fff2d50d82d
0x00007ffeea1b14d0:   00007fff2d50d859 0000000000000062
0x00007ffeea1b14e0:   00007fff2d50d937 00007f8380538520
0x00007ffeea1b14f0:   00007fff564fbe80 00000001096b0690
0x00007ffeea1b1500:   00007fff2d516211 00000001096b06b0
0x00007ffeea1b1510:   00007ffeea1b1550 00000001096abd3a
0x00007ffeea1b1520:   0000000000000000 00007f838062a7b0
0x00007ffeea1b1530:   00007fff564fbe80 00007f8380538520
0x00007ffeea1b1540:   00007f83804462a0 0000000000000000
0x00007ffeea1b1550:   00007ffeea1b15a0 0000000109624544
0x00007ffeea1b1560:   00007f8380538520 0000000000000000
0x00007ffeea1b1570:   00007f83804462a0 00007f838061dc20
0x00007ffeea1b1580:   00007f83804041a0 00007fff2d50ce91
0x00007ffeea1b1590:   00007f838061de50 0000000000000000
0x00007ffeea1b15a0:   00007ffeea1b15c0 00007fff3301ef4a
0x00007ffeea1b15b0:   0000000000000018 0000000000000001
0x00007ffeea1b15c0:   00007ffeea1b1640 00007fff314262b5
0x00007ffeea1b15d0:   0000000000000001 00007fff2d50cf70
0x00007ffeea1b15e0:   00007f83804041a0 00007f838061b850
0x00007ffeea1b15f0:   00007fff2d514372 00007fff2d5673b7
0x00007ffeea1b1600:   00007fff2d514377 00007fff2d50d003
0x00007ffeea1b1610:   00007ffeea1b1650 00007fff31426167
0x00007ffeea1b1620:   0000000300002e88 0000000000000000 

Instructions: (pc=0x00000001096ac0cc)
0x00000001096ac0ac:   41 5f 5d c3 48 8b 35 51 58 00 00 4c 8b 35 ca 3f
0x00000001096ac0bc:   00 00 48 89 df 41 ff d6 48 89 c3 31 c0 48 89 df
0x00000001096ac0cc:   ff 53 10 48 8b 35 1a 56 00 00 48 89 df 4c 89 f0
0x00000001096ac0dc:   48 83 c4 18 5b 41 5e 41 5f 5d ff e0 55 48 89 e5 


---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x00007f8381bd4000 JavaThread "J3D-Renderer-1" [_thread_blocked, id=72451, stack(0x000070000bb92000,0x000070000bc92000)]
  0x00007f83814ae000 JavaThread "J3D-MasterControl-1" [_thread_blocked, id=72707, stack(0x000070000ba8f000,0x000070000bb8f000)]
  0x00007f8381de2000 JavaThread "J3D-NotificationThread" [_thread_blocked, id=57603, stack(0x000070000b98c000,0x000070000ba8c000)]
  0x00007f8381c2a000 JavaThread "J3D-TimerThread" [_thread_blocked, id=73223, stack(0x000070000b889000,0x000070000b989000)]
  0x00007f8381df7800 JavaThread "J3D-RenderingAttributesStructureUpdateThread" [_thread_blocked, id=73747, stack(0x000070000b786000,0x000070000b886000)]
  0x00007f8381cdc000 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=76051, stack(0x000070000b683000,0x000070000b783000)]
  0x00007f8381519800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=56079, stack(0x000070000b580000,0x000070000b680000)]
  0x00007f8381bf1800 JavaThread "Java2D Queue Flusher" daemon [_thread_blocked, id=83111, stack(0x000070000b47d000,0x000070000b57d000)]
  0x00007f8380c77800 JavaThread "AWT-Shutdown" [_thread_blocked, id=35115, stack(0x000070000b16e000,0x000070000b26e000)]
=>0x00007f838098e800 JavaThread "AppKit Thread" daemon [_thread_in_native, id=775, stack(0x00007ffee61b5000,0x00007ffeea1b4000)]
  0x00007f83818c9000 JavaThread "Service Thread" daemon [_thread_blocked, id=41219, stack(0x000070000af68000,0x000070000b068000)]
  0x00007f8382006000 JavaThread "Common-Cleaner" daemon [_thread_blocked, id=41475, stack(0x000070000ae65000,0x000070000af65000)]
  0x00007f8382000000 JavaThread "Sweeper thread" daemon [_thread_blocked, id=41987, stack(0x000070000ad62000,0x000070000ae62000)]
  0x00007f8381890800 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=42499, stack(0x000070000ac5f000,0x000070000ad5f000)]
  0x00007f838188f800 JavaThread "C2 CompilerThread1" daemon [_thread_in_native, id=43011, stack(0x000070000ab5c000,0x000070000ac5c000)]
  0x00007f8381091000 JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=43267, stack(0x000070000aa59000,0x000070000ab59000)]
  0x00007f838188f000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=16395, stack(0x000070000a956000,0x000070000aa56000)]
  0x00007f8380803800 JavaThread "Finalizer" daemon [_thread_blocked, id=18435, stack(0x000070000a853000,0x000070000a953000)]
  0x00007f8381864000 JavaThread "Reference Handler" daemon [_thread_blocked, id=14595, stack(0x000070000a750000,0x000070000a850000)]
  0x00007f8381017800 JavaThread "main" [_thread_blocked, id=6403, stack(0x0000700009a29000,0x0000700009b29000)]

Other Threads:
  0x00007f8381873000 VMThread "VM Thread" [stack: 0x000070000a64d000,0x000070000a74d000] [id=14083]
  0x00007f83810e3800 WatcherThread [stack: 0x000070000b06b000,0x000070000b16b000] [id=22531]
  0x00007f8381020000 GCTaskThread "GC Thread#0" [stack: 0x0000700009b2c000,0x0000700009c2c000] [id=11011]
  0x00007f8381020800 GCTaskThread "GC Thread#1" [stack: 0x0000700009c2f000,0x0000700009d2f000] [id=21507]
  0x00007f8381021800 GCTaskThread "GC Thread#2" [stack: 0x0000700009d32000,0x0000700009e32000] [id=21251]
  0x00007f8381812000 GCTaskThread "GC Thread#3" [stack: 0x0000700009e35000,0x0000700009f35000] [id=12035]
  0x00007f8381838000 ConcurrentGCThread "G1 Main Marker" [stack: 0x000070000a447000,0x000070000a547000] [id=19203]
  0x00007f8381838800 ConcurrentGCThread "G1 Marker#0" [stack: 0x000070000a54a000,0x000070000a64a000] [id=13571]
  0x00007f8381008800 ConcurrentGCThread "G1 Refine#0" [stack: 0x000070000a241000,0x000070000a341000] [id=19715]
  0x00007f8381008000 ConcurrentGCThread "G1 Refine#1" [stack: 0x000070000a13e000,0x000070000a23e000] [id=19971]
  0x00007f8380803000 ConcurrentGCThread "G1 Refine#2" [stack: 0x000070000a03b000,0x000070000a13b000] [id=20483]
  0x00007f8381812800 ConcurrentGCThread "G1 Refine#3" [stack: 0x0000700009f38000,0x000070000a038000] [id=12291]
  0x00007f8381009800 ConcurrentGCThread "G1 Young RemSet Sampling" [stack: 0x000070000a344000,0x000070000a444000] [id=19459]

Threads with active compile tasks:
C2 CompilerThread11799       4       java.lang.invoke.InvokerBytecodeGenerator::emitImplicitConversion (159 bytes)
C2 CompilerThread01837       4       java.util.jar.JarFile::getEntry (60 bytes)

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap address: 0x0000000740000000, size: 2048 MB, Compressed Oops mode: Zero based, Oop shift amount: 3
Narrow klass base: 0x0000000000000000, Narrow klass shift: 3
Compressed class space size: 1073741824 Address: 0x00000007c0000000

Looks the same as this:
https://bugs.openjdk.java.net/browse/JDK-8197910

More workarounds and tries that didn't work for me:
http://forum.jogamp.org/Jogl-Jogamp-on-Java-9-tt4038012.html

Hi julianoes, Did you solve this problem? because i have a same problem too.

i tried to run jmavsim_run.jar with java7 and java8 but it showed the different errors.

So, if you have any advice then please notice me.

thanks.

It works with Java 8. Make sure to clean build by deleting the out folder, and otherwise post your error.

@julianoes Thanks. i will try it!


It works. Thank you so much for your help.

Hi!
I have the same problem, i'm using java 11. What's the out folder?
Thanks

The steps for the Java 8 workaround are:

cd wherever/Firmware
rm -rf Tools/jMAVSim/out
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
make posix jmavsim

Also, see: http://discuss.px4.io/t/problem-running-jmavsim-on-macos-high-sierra/5357/20

@nicollorens12 could it be that you ran the simulation in a new shell window after doing the steps I mentioned above? The export command is only valid for the current shell, and it could be that you're seeing these errors because it is using Java 11 to run the Java 8 compiled code.

@nicollorens12 you need to follow the steps I posted above.

I'm trying the export comand but I get this error. bash: /usr/libexec/java_home: No such file or directory

Ok, this probably means that you don't have Java 8 installed. I'd try to install Java 8.

Have you tried -version or --version?

Look through the output, something must have failed if you see that.

@nicollorens12 can you please do make clean and then build it and copy all of the output to pastebin and link it here?

I would need "all of the output" including make clean, the exports, etc.

Ok, so the export command didn't work, so of course jMAVSim won't work properly later.

export JAVA_Home=$(/usr/libexec/java_home -v 1.8)
bash: /usr/libexec/java_home: No such file or directory

I would try to install Oracle Java SE Development Kit 8:
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

And on the side, why are you doing these things as root? That seems dangerous.

Oh, and I was assuming and trying to help with macOS!

This issue is about macOS not Ubuntu. For Ubuntu I suggest you create a new issue, that way it gets clearer.