Opened 15 months ago

Closed 3 weeks ago

Last modified 3 weeks ago

#2299 closed defect (fixed)

Incompatible with OSX High Sierra / Java 10.0.2

Reported by: jogger Owned by: Meeh
Priority: major Milestone: 0.9.44
Component: installer Version: 0.9.36
Keywords: Cc:
Parent Tickets: Sensitive: no

Description (last modified by zzz)

With High Sierra Java is at /Library/Internet?\ Plug-Ins/JavaAppletPlugin?.plugin/Contents/Home/bin/java

Bug 1: runplain.sh gets this wrong due to a simple quoting error omitting the backslash, thus running an outdated java version as described below. Correct script adding \ and " :

JAVA=$(which /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java || which java)

if [ -z "$JAVA" ] || [ ! -x "$JAVA" ]; then
    echo "Error: Cannot find java." >&2
    exit 1
fi

for jar in `ls ${I2P}/lib/*.jar`; do
    if [ ! -z $CP ]; then
        CP=${CP}:${jar};
    else
        CP=${jar}
    fi
done

if [ $(uname -s) = "Darwin" ]; then
    export JAVA_TOOL_OPTIONS="-Djava.awt.headless=true"
fi
JAVAOPTS="${MAXMEMOPT} -Djava.net.preferIPv4Stack=${PREFERv4} -Djava.library.path=${I2P}:${I2P}/lib -Di2p.dir.base=${I2P} -DloggerFilenameOverride=logs/log-router-@.txt"
(
    nohup "${JAVA}" -cp \"${CP}\" ${JAVAOPTS} net.i2p.router.RouterLaunch > /dev/null 2>&1
) &

Bug 2:

The java command issued by the wrapper starts a random outdated Java (I found 1.8.0_25, 9.0.1 and 9.0.4 on different machines) that has been left over from earlier OS installs, it is one of those listed by "/usr/libexec/java_home -V"

The correct way to start an application on OSX is to use the open command, e.g. "open test.jar" instead of "java -jar test.jar". The "open" command will find the correct Java, while "java" does not.

This can not be fixed by simply adding "export JAVA_HOME="/Library/Internet? Plug-Ins/JavaAppletPlugin?.plugin/Contents/Home"" to the "i2prouter" script within the "Start I2P Router" application. Java 10 does not like the "-d64" option used.

Subtickets

Change History (12)

comment:1 Changed 15 months ago by zzz

Component: router/generalinstaller
Milestone: undecided0.9.37
Owner: set to Meeh
Status: newassigned

comment:2 Changed 15 months ago by jogger

I was able to get the above fix (export JAVA_HOME) to work by setting autobits to false in wrapper.config.

Notes:

  • Successfully upgraded to wrapper 3.5.55 in the process.
  • i2p performance is awful with runplain.sh on OSX. Watchdog barking all the time.
  • On OSX my torrents (residing on SD card) are wrecked every time I shut i2p down. Everything rescanned every time, sometimes data corrupted.

comment:3 Changed 6 months ago by Meeh

Owner: changed from Meeh to zzz

@zzz: Should we still patch on the old install system on OSX, or ask people to move to OSX Launcher?

comment:4 Changed 6 months ago by zzz

Milestone: 0.9.370.9.41
Owner: changed from zzz to Meeh

@meeh the bugs in the OP sound like easy things to change and test, so I suggest you do that for .41 = it could be useful for people building local installers, even if we do change the recommendation on our download page. I don't think we're ready yet to abandon the old installer completely.

Officially moving to the OSX launcher probably requires a meeting sometime, let's not do that discussion in this ticket.

comment:5 Changed 2 months ago by jogger

Sensitive: unset

Current state:

The "Start I2P Router" application still fails silently on any recent Java > 8 because of the autobits settings in wrapper.config.

The i2prouter script has a test for $JAVA_HOME which works differently from the command line versus when called from the "Start I2P Router" application, because the "Start I2P Router" application does not read in stuff like .bash_profile.

comment:6 Changed 2 months ago by zzz

Milestone: 0.9.410.9.43

@meeh status?

comment:7 Changed 7 weeks ago by zzz

Description: modified (diff)

see #2625 for performance issue from comment 2?

@OP can you provide a patch for bug 1?

@meeh status?

comment:8 Changed 6 weeks ago by jogger

The following should work on every MacOS:

--- i2p-0.9.42/installer/resources/runplain.sh
+++ 42dev/installer/resources/runplain.sh
@@ -25,7 +25,7 @@
 
 # Try using the Java binary that I2P was installed with.
 # If it's not found, try looking in the system PATH.
-JAVA=$(which %JAVA_HOME/bin/java || which java)
+JAVA=$(which "%JAVA_HOME"/bin/java || which java)
 
 if [ -z $JAVA ] || [ ! -x $JAVA ]; then
     echo "Error: Cannot find java." >&2

Comment 2 / bug 2 does not at all relate to performance. Any recent Java (from 9 or 10 - any platform) barks at the -d64 generated from autobits=true :

$ java -d64 -version
Unrecognized option: -d64
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Patch for bug 2:

--- i2p-0.9.42/installer/resources/wrapper.config
+++ 42dev/installer/resources/wrapper.config
@@ -69,7 +69,7 @@
 wrapper.java.library.path.2=$INSTALL_PATH/lib
 
 # Java Bits.  On applicable platforms, tells the JVM to run in 32 or 64-bit mode.
-wrapper.java.additional.auto_bits=TRUE
+wrapper.java.additional.auto_bits=FALSE
 
 # Java Additional Parameters
 # Numbers must be consecutive (except for stripquotes)

comment:9 Changed 6 weeks ago by zzz

re: bug 2, first report we've had, just tested on linux with java 11 and either TRUE or FALSE. Perhaps a mac-only issue or a wrapper issue? What wrapper version do you have (reported at top of /logs) ? We will have to research tanuki docs and change log.

comment:10 Changed 6 weeks ago by jogger

OK, should have written any of my 64 bit platforms. First was ARM64 long ago, I do not have access any more, compiled everything myself.

Current are some Macs on Mojave, loaded wrapper 3.5.40 from Tanuki website. Since this bug is a bit older I can confirm it affects also older wrapper versions and all Java 10-13.

comment:11 Changed 3 weeks ago by Meeh

Resolution: fixed
Status: assignedclosed

Confirmed, and patches applied.

comment:12 Changed 3 weeks ago by zzz

Milestone: 0.9.430.9.44
Note: See TracTickets for help on using tickets.