forked from I2P_Developers/i2p.i2p
Router: Fix low-memory log messages for non-wrapper (ticket #1795)
Install: Add max memory option to runplain.sh Build: Fix minimum Java version for Windows
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
<customProcName>false</customProcName>
|
<customProcName>false</customProcName>
|
||||||
<icon>resources/console.ico</icon>
|
<icon>resources/console.ico</icon>
|
||||||
<jre>
|
<jre>
|
||||||
<minVersion>1.6.0</minVersion>
|
<minVersion>1.7.0</minVersion>
|
||||||
</jre>
|
</jre>
|
||||||
<!--
|
<!--
|
||||||
<splash>
|
<splash>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<customProcName>false</customProcName>
|
<customProcName>false</customProcName>
|
||||||
<icon>resources/start.ico</icon>
|
<icon>resources/start.ico</icon>
|
||||||
<jre>
|
<jre>
|
||||||
<minVersion>1.6.0</minVersion>
|
<minVersion>1.7.0</minVersion>
|
||||||
<!--
|
<!--
|
||||||
<minHeapSize>64</minHeapSize>
|
<minHeapSize>64</minHeapSize>
|
||||||
-->
|
-->
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
# This runs the router by itself, WITHOUT the wrapper.
|
# This runs the router by itself, WITHOUT the wrapper.
|
||||||
# This means the router will not restart if it crashes.
|
# This means the router will not restart if it crashes.
|
||||||
# Also, you will be using the default memory size, which is
|
# Also, you will be using the default memory size, which is
|
||||||
# probably not enough for i2p.
|
# probably not enough for i2p, unless you set it below.
|
||||||
# You should really use the i2prouter script instead.
|
# You should really use the i2prouter script instead.
|
||||||
#
|
#
|
||||||
|
|
||||||
@@ -19,6 +19,10 @@ I2PTEMP="%SYSTEM_java_io_tmpdir"
|
|||||||
PREFERv4="false"
|
PREFERv4="false"
|
||||||
CP=
|
CP=
|
||||||
|
|
||||||
|
# Uncomment to set the maximum memory. The default and the option may vary in different JVMs.
|
||||||
|
# Check your java documentation to be sure.
|
||||||
|
#MAXMEMOPT="-Xmx256m"
|
||||||
|
|
||||||
# Try using the Java binary that I2P was installed with.
|
# Try using the Java binary that I2P was installed with.
|
||||||
# If it's not found, try looking in the system PATH.
|
# 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)
|
||||||
@@ -39,7 +43,7 @@ done
|
|||||||
if [ $(uname -s) = "Darwin" ]; then
|
if [ $(uname -s) = "Darwin" ]; then
|
||||||
export JAVA_TOOL_OPTIONS="-Djava.awt.headless=true"
|
export JAVA_TOOL_OPTIONS="-Djava.awt.headless=true"
|
||||||
fi
|
fi
|
||||||
JAVAOPTS="-Djava.net.preferIPv4Stack=${PREFERv4} -Djava.library.path=${I2P}:${I2P}/lib -Di2p.dir.base=${I2P} -DloggerFilenameOverride=logs/log-router-@.txt"
|
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
|
nohup ${JAVA} -cp \"${CP}\" ${JAVAOPTS} net.i2p.router.RouterLaunch > /dev/null 2>&1
|
||||||
) &
|
) &
|
||||||
|
@@ -49,17 +49,23 @@ public class OOMListener implements I2PThread.OOMEventListener {
|
|||||||
log.log(Log.CRIT, "Thread ran out of memory, shutting down I2P", oom);
|
log.log(Log.CRIT, "Thread ran out of memory, shutting down I2P", oom);
|
||||||
log.log(Log.CRIT, "free mem: " + Runtime.getRuntime().freeMemory() +
|
log.log(Log.CRIT, "free mem: " + Runtime.getRuntime().freeMemory() +
|
||||||
" total mem: " + Runtime.getRuntime().totalMemory());
|
" total mem: " + Runtime.getRuntime().totalMemory());
|
||||||
|
// Can't find any System property or wrapper property that gives
|
||||||
|
// you the actual config file path, have to guess
|
||||||
|
String path;
|
||||||
|
if (SystemVersion.isLinuxService()) {
|
||||||
|
path = "/etc/i2p";
|
||||||
|
} else {
|
||||||
|
path = _context.getBaseDir().toString();
|
||||||
|
}
|
||||||
if (_context.hasWrapper()) {
|
if (_context.hasWrapper()) {
|
||||||
// Can't find any System property or wrapper property that gives
|
|
||||||
// you the actual config file path, have to guess
|
|
||||||
String path;
|
|
||||||
if (SystemVersion.isLinuxService()) {
|
|
||||||
path = "/etc/i2p";
|
|
||||||
} else {
|
|
||||||
path = _context.getBaseDir().toString();
|
|
||||||
}
|
|
||||||
log.log(Log.CRIT, "To prevent future shutdowns, increase wrapper.java.maxmemory in " +
|
log.log(Log.CRIT, "To prevent future shutdowns, increase wrapper.java.maxmemory in " +
|
||||||
path + File.separatorChar + "wrapper.config");
|
path + File.separatorChar + "wrapper.config");
|
||||||
|
} else if (!SystemVersion.isWindows()) {
|
||||||
|
log.log(Log.CRIT, "To prevent future shutdowns, increase MAXMEMOPT in " +
|
||||||
|
path + File.separatorChar + "runplain.sh or /usr/bin/i2prouter-nowrapper");
|
||||||
|
} else {
|
||||||
|
log.log(Log.CRIT, "To prevent future shutdowns, run the restartable version of I2P, and increase wrapper.java.maxmemory in " +
|
||||||
|
path + File.separatorChar + "wrapper.config");
|
||||||
}
|
}
|
||||||
} catch (OutOfMemoryError oome) {}
|
} catch (OutOfMemoryError oome) {}
|
||||||
try {
|
try {
|
||||||
|
@@ -104,7 +104,6 @@ class BloomFilterIVValidator implements IVValidator {
|
|||||||
return;
|
return;
|
||||||
// Can't find any System property or wrapper property that gives
|
// Can't find any System property or wrapper property that gives
|
||||||
// you the actual config file path, have to guess
|
// you the actual config file path, have to guess
|
||||||
// TODO if !SystemVersion.hasWrapper ...
|
|
||||||
String path;
|
String path;
|
||||||
if (SystemVersion.isLinuxService()) {
|
if (SystemVersion.isLinuxService()) {
|
||||||
path = "/etc/i2p";
|
path = "/etc/i2p";
|
||||||
@@ -114,13 +113,21 @@ class BloomFilterIVValidator implements IVValidator {
|
|||||||
String msg =
|
String msg =
|
||||||
"Configured for " + DataHelper.formatSize(KBps *1024L) +
|
"Configured for " + DataHelper.formatSize(KBps *1024L) +
|
||||||
"Bps share bandwidth but only " +
|
"Bps share bandwidth but only " +
|
||||||
DataHelper.formatSize(maxMemory) + "B available memory." +
|
DataHelper.formatSize(maxMemory) + "B available memory.";
|
||||||
" Recommend increasing wrapper.java.maxmemory in " +
|
if (_context.hasWrapper()) {
|
||||||
path + File.separatorChar + "wrapper.config" +
|
msg += " Recommend increasing wrapper.java.maxmemory in " +
|
||||||
// getMaxMemory() returns significantly lower than wrapper config, so add 10%
|
path + File.separatorChar + "wrapper.config";
|
||||||
" to at least " + (recMaxMem * 11 / 10 / (1024*1024)) + " (MB)" +
|
} else if (!SystemVersion.isWindows()) {
|
||||||
" if the actual share bandwidth exceeds " +
|
msg += " Recommend increasing MAXMEMOPT in " +
|
||||||
DataHelper.formatSize(threshKBps * 1024L) + "Bps.";
|
path + File.separatorChar + "runplain.sh or /usr/bin/i2prouter-nowrapper";
|
||||||
|
} else {
|
||||||
|
msg += " Recommend running the restartable version of I2P, and increasing wrapper.java.maxmemory in " +
|
||||||
|
path + File.separatorChar + "wrapper.config";
|
||||||
|
}
|
||||||
|
// getMaxMemory() returns significantly lower than wrapper config, so add 10%
|
||||||
|
msg += " to at least " + (recMaxMem * 11 / 10 / (1024*1024)) + " (MB)" +
|
||||||
|
" if the actual share bandwidth exceeds " +
|
||||||
|
DataHelper.formatSize(threshKBps * 1024L) + "Bps.";
|
||||||
System.out.println("WARN: " + msg);
|
System.out.println("WARN: " + msg);
|
||||||
_context.logManager().getLog(BloomFilterIVValidator.class).logAlways(Log.WARN, msg);
|
_context.logManager().getLog(BloomFilterIVValidator.class).logAlways(Log.WARN, msg);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user