diff --git a/router/java/src/net/i2p/router/tasks/OOMListener.java b/router/java/src/net/i2p/router/tasks/OOMListener.java index d303659932a339305f4848bc4f934d3262849997..7f09f677dc9fdb7aea721ea863d46774d0174df5 100644 --- a/router/java/src/net/i2p/router/tasks/OOMListener.java +++ b/router/java/src/net/i2p/router/tasks/OOMListener.java @@ -8,6 +8,7 @@ import net.i2p.router.RouterContext; import net.i2p.router.util.EventLog; import net.i2p.util.I2PThread; import net.i2p.util.Log; +import net.i2p.util.SystemVersion; /** * Kaboom @@ -48,9 +49,19 @@ 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()); - 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.isWindows() && !SystemVersion.isMac() && + "i2psvc".equals(System.getProperty("user.name"))) { + path = "/etc/i2p"; + } else { + path = _context.getBaseDir().toString(); + } log.log(Log.CRIT, "To prevent future shutdowns, increase wrapper.java.maxmemory in " + - _context.getBaseDir() + File.separatorChar + "wrapper.config"); + path + File.separatorChar + "wrapper.config"); + } } catch (OutOfMemoryError oome) {} try { ThreadDump.dump(_context, 1); diff --git a/router/java/src/net/i2p/router/tunnel/BloomFilterIVValidator.java b/router/java/src/net/i2p/router/tunnel/BloomFilterIVValidator.java index 0c872fea66fc1ff08a5978c5f3e5fa849768b0fe..beb6ec438b0a00c471d63b5e5d909f7d4c1b2f0d 100644 --- a/router/java/src/net/i2p/router/tunnel/BloomFilterIVValidator.java +++ b/router/java/src/net/i2p/router/tunnel/BloomFilterIVValidator.java @@ -96,12 +96,22 @@ class BloomFilterIVValidator implements IVValidator { private void warn(long maxMemory, int KBps, long recMaxMem, int threshKBps) { if (SystemVersion.isAndroid()) 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.isWindows() && !SystemVersion.isMac() && + "i2psvc".equals(System.getProperty("user.name"))) { + path = "/etc/i2p"; + } else { + path = _context.getBaseDir().toString(); + } String msg = "Configured for " + DataHelper.formatSize(KBps *1024) + "Bps share bandwidth but only " + DataHelper.formatSize(maxMemory) + "B available memory." + " Recommend increasing wrapper.java.maxmemory in " + - _context.getBaseDir() + File.separatorChar + "wrapper.config" + + 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 " +