Skip to content

An installed Oracle Java crashes Arduino IDE 1.8.13 on macos #11055

Open
@morungos

Description

@morungos

When attempting to start the IDE on a Mac with Java installed, it crashes out after showing the splash screen. It's not entirely predictable, because I've been using the IDE with reasonable success until a week or so ago. However, there is enough that this seems to be a bug. It appears to be searching for Java versions and accidentally finding the browser plugin one rather than an actual functioning Java. Erasing Oracle Java from the system (as per: https://stackoverflow.com/questions/19039752/removing-java-8-jdk-from-mac) does resolve the problem, and the IDE then starts successfully.

OS: Macos 11.0.1
Arduino IDE: 1.8.13
Oracle Java versions installed: jdk1.8.0_111 and jdk1.7.0_80.jdk
(Note: switching off browser plugins did not solve the problem).

The problem shows up in the command line when starting the IDE directly. With Oracle Java installed, key lines:

2020-12-10 17:01:47.362 Arduino[1815:26249] JVMArguments=(
)
2020-12-10 17:01:47.362 Arduino[1815:26249] JVMClasspath=(null)
2020-12-10 17:01:47.362 Arduino[1815:26249] JVMDefaultOptions={
}
2020-12-10 17:01:47.362 Arduino[1815:26249] -> Bundle path: /Applications/Arduino.app
2020-12-10 17:01:47.362 Arduino[1815:26249] -> Working Directory: '/Users/stuart'
2020-12-10 17:01:47.362 Arduino[1815:26249] -> JVM Runtime path: /Applications/Arduino.app/Contents/PlugIns/jre8u252-b09.jre
2020-12-10 17:01:47.363 Arduino[1815:26249] Searching for a Java 8 virtual machine
2020-12-10 17:01:47.363 Arduino[1815:26249] Search for java VM in '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home'
2020-12-10 17:01:47.457 Arduino[1815:26249] -> JVM Runtime path updated to: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin
2020-12-10 17:01:47.457 Arduino[1815:26249] -> Java Runtime Dylib Path: '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib'
2020-12-10 17:01:47.458 Arduino[1815:26249] Command line passed to application argc=21:
2020-12-10 17:01:47.458 Arduino[1815:26249] Arg 0: '/Applications/Arduino.app/Contents/MacOS/Arduino'
...

There is more, but it's verbose and doesn't seem particularly relevant. However, the JVM Runtime path updated to: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin does seem to be a useful sign of an erroneous startup step.

The startup then fails with:

Set log4j store directory /Users/stuart/Library/Arduino15
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fff203820a9, pid=1815, tid=0x0000000000000307
#
# JRE version: Java(TM) SE Runtime Environment (8.0_201-b09) (build 1.8.0_201-b09)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.201-b09 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [libsystem_platform.dylib+0x10a9]  _platform_memmove$VARIANT$Haswell+0x29
#
# Failed to write core dump. 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/stuart/hs_err_pid1815.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.
#

I doubt if the more detailed log is useful, but I'll add if requested. However, one line does jump out -- showing a mixup between java.ext.dirs and java.library.path that looks like a harbinger of doom.

jvm_args: -Djava.library.path=/Applications/Arduino.app/Contents/MacOS -DLibraryDirectory=/Users/stuart/Library -DDocumentsDirectory=/Users/stuart/Documents -DApplicationSupportDirectory=/Users/stuart/Library/Application Support -DCachesDirectory=/Users/stuart/Library/Caches -DSandboxEnabled=true -Dapple.awt.application.name=Arduino -Dcom.apple.macos.use-file-dialog-packages=true -Dcom.apple.smallTabs=true -DAPP_DIR=/Applications/Arduino.app/Contents/Java -Djava.ext.dirs=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/ext/:/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/jre/lib/ext/ -Djava.net.preferIPv4Stack=true -Dcom.apple.mrj.application.apple.menu.about.name=Arduino -Dfile.encoding=UTF-8 -Xms128M -Xmx512M 

After removing Oracle Java (I do still have an OpenJDK install):

2020-12-10 17:07:28.341 Arduino[1393:8717] JVMArguments=(
)
2020-12-10 17:07:28.341 Arduino[1393:8717] JVMClasspath=(null)
2020-12-10 17:07:28.341 Arduino[1393:8717] JVMDefaultOptions={
}
2020-12-10 17:07:28.341 Arduino[1393:8717] -> Bundle path: /Applications/Arduino.app
2020-12-10 17:07:28.341 Arduino[1393:8717] -> Working Directory: '/Users/stuart'
2020-12-10 17:07:28.341 Arduino[1393:8717] -> JVM Runtime path: /Applications/Arduino.app/Contents/PlugIns/jre8u252-b09.jre
2020-12-10 17:07:28.341 Arduino[1393:8717] Searching for a Java 8 virtual machine
2020-12-10 17:07:28.341 Arduino[1393:8717] Search for java VM in '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home'
2020-12-10 17:07:28.342 Arduino[1393:8717]   KO - error: 'launch path not accessible'
2020-12-10 17:07:28.357 Arduino[1393:8717] Search for java VM in '/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home'
2020-12-10 17:07:28.463 Arduino[1393:8717]   KO - invalid 'java -version' output
2020-12-10 17:07:28.463 Arduino[1393:8717] -> Java Runtime Dylib Path: '/Applications/Arduino.app/Contents/PlugIns/jre8u252-b09.jre/Contents/Home/lib/jli/libjli.dylib'
2020-12-10 17:07:28.465 Arduino[1393:8717] Command line passed to application argc=21:
2020-12-10 17:07:28.465 Arduino[1393:8717] Arg 0: '/Applications/Arduino.app/Contents/MacOS/Arduino'

Despite these log lines, the IDE seems to start and run fine.

This seems to be fairly easy to work around by simply removing Oracle Java entirely (unless you really need Oracle Java, and let's be honest, who does?) but the user experience is not especially helpful (a vanilla crash) so it would be great if the IDE could avoid this issue in future.

Note that there is some similarity to #9828, and there are mentions of issues relating to the Java bundled inside Arduino on the in the forums, but this seems to be a distinct issue, as origins seem to be more in Oracle Java and its Mac paths than anything else.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: IDEThe Arduino IDEOS: OSXSpecific to the Mac OS X (macOS) version of the Arduino IDEType: Bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions