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:
zzz
2016-11-08 15:42:22 +00:00
parent b559b412aa
commit e614b0996d
5 changed files with 37 additions and 20 deletions

View File

@@ -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 {

View File

@@ -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);
}