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>
|
||||
<icon>resources/console.ico</icon>
|
||||
<jre>
|
||||
<minVersion>1.6.0</minVersion>
|
||||
<minVersion>1.7.0</minVersion>
|
||||
</jre>
|
||||
<!--
|
||||
<splash>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<customProcName>false</customProcName>
|
||||
<icon>resources/start.ico</icon>
|
||||
<jre>
|
||||
<minVersion>1.6.0</minVersion>
|
||||
<minVersion>1.7.0</minVersion>
|
||||
<!--
|
||||
<minHeapSize>64</minHeapSize>
|
||||
-->
|
||||
|
@@ -3,7 +3,7 @@
|
||||
# This runs the router by itself, WITHOUT the wrapper.
|
||||
# This means the router will not restart if it crashes.
|
||||
# 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.
|
||||
#
|
||||
|
||||
@@ -19,6 +19,10 @@ I2PTEMP="%SYSTEM_java_io_tmpdir"
|
||||
PREFERv4="false"
|
||||
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.
|
||||
# If it's not found, try looking in the system PATH.
|
||||
JAVA=$(which %JAVA_HOME/bin/java || which java)
|
||||
@@ -39,7 +43,7 @@ done
|
||||
if [ $(uname -s) = "Darwin" ]; then
|
||||
export JAVA_TOOL_OPTIONS="-Djava.awt.headless=true"
|
||||
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
|
||||
) &
|
||||
|
@@ -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, "free mem: " + Runtime.getRuntime().freeMemory() +
|
||||
" 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()) {
|
||||
// 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 " +
|
||||
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) {}
|
||||
try {
|
||||
|
@@ -104,7 +104,6 @@ class BloomFilterIVValidator implements IVValidator {
|
||||
return;
|
||||
// Can't find any System property or wrapper property that gives
|
||||
// you the actual config file path, have to guess
|
||||
// TODO if !SystemVersion.hasWrapper ...
|
||||
String path;
|
||||
if (SystemVersion.isLinuxService()) {
|
||||
path = "/etc/i2p";
|
||||
@@ -114,13 +113,21 @@ class BloomFilterIVValidator implements IVValidator {
|
||||
String msg =
|
||||
"Configured for " + DataHelper.formatSize(KBps *1024L) +
|
||||
"Bps share bandwidth but only " +
|
||||
DataHelper.formatSize(maxMemory) + "B available memory." +
|
||||
" Recommend increasing wrapper.java.maxmemory in " +
|
||||
path + File.separatorChar + "wrapper.config" +
|
||||
// getMaxMemory() returns significantly lower than wrapper config, so add 10%
|
||||
" to at least " + (recMaxMem * 11 / 10 / (1024*1024)) + " (MB)" +
|
||||
" if the actual share bandwidth exceeds " +
|
||||
DataHelper.formatSize(threshKBps * 1024L) + "Bps.";
|
||||
DataHelper.formatSize(maxMemory) + "B available memory.";
|
||||
if (_context.hasWrapper()) {
|
||||
msg += " Recommend increasing wrapper.java.maxmemory in " +
|
||||
path + File.separatorChar + "wrapper.config";
|
||||
} else if (!SystemVersion.isWindows()) {
|
||||
msg += " Recommend increasing MAXMEMOPT in " +
|
||||
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);
|
||||
_context.logManager().getLog(BloomFilterIVValidator.class).logAlways(Log.WARN, msg);
|
||||
}
|
||||
|
Reference in New Issue
Block a user