- Timestamp:
- May 26, 2018 11:46:59 AM (3 years ago)
- Branches:
- master
- Children:
- 39c0f55
- Parents:
- 9eb3cc5
- Location:
- router/java/src/net/i2p/router
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
router/java/src/net/i2p/router/tasks/OOMListener.java
r9eb3cc5 rc1b9aa9 50 50 log.log(Log.CRIT, "free mem: " + Runtime.getRuntime().freeMemory() + 51 51 " total mem: " + Runtime.getRuntime().totalMemory()); 52 // Can't find any System property or wrapper property that gives 53 // you the actual config file path, have to guess 54 String path; 55 if (SystemVersion.isLinuxService()) { 56 if (SystemVersion.isGentoo()) 57 path = "/usr/share/i2p"; 58 else 59 path = "/etc/i2p"; 60 } else { 61 path = _context.getBaseDir().toString(); 62 } 52 String path = getWrapperConfigPath(_context); 63 53 if (_context.hasWrapper()) { 64 54 log.log(Log.CRIT, "To prevent future shutdowns, increase wrapper.java.maxmemory in " + 65 path + File.separatorChar + "wrapper.config");55 path); 66 56 } else if (!SystemVersion.isWindows()) { 67 57 log.log(Log.CRIT, "To prevent future shutdowns, increase MAXMEMOPT in " + 68 path+ File.separatorChar + "runplain.sh or /usr/bin/i2prouter-nowrapper");58 _context.getBaseDir() + File.separatorChar + "runplain.sh or /usr/bin/i2prouter-nowrapper"); 69 59 } else { 70 60 log.log(Log.CRIT, "To prevent future shutdowns, run the restartable version of I2P, and increase wrapper.java.maxmemory in " + 71 path + File.separatorChar + "wrapper.config");61 path); 72 62 } 73 63 } catch (OutOfMemoryError oome) {} … … 82 72 } catch (OutOfMemoryError oome) {} 83 73 } 74 75 /** 76 * Best guess if running from a Debian package 77 * @since 0.9.35 78 */ 79 private static boolean isDebianPackage(RouterContext ctx) { 80 boolean isDebian = !SystemVersion.isWindows() && !SystemVersion.isMac() && 81 !SystemVersion.isGentoo() && !SystemVersion.isAndroid() && 82 System.getProperty("os.name").startsWith("Linux") && 83 (new File("/etc/debian_version")).exists(); 84 return isDebian && 85 ctx.getBaseDir().getPath().equals("/usr/share/i2p") && 86 ctx.getBooleanProperty("router.updateDisabled"); 87 } 88 89 /** 90 * Best guess of wrapper.config path. 91 * Can't find any System property or wrapper property that gives 92 * you the actual config file path, have to guess. 93 * Does not necessarily exist. 94 * @since 0.9.35 consolidated from above and BloomFilterIVValidator 95 */ 96 public static String getWrapperConfigPath(RouterContext ctx) { 97 File path; 98 if (SystemVersion.isLinuxService()) { 99 if (SystemVersion.isGentoo()) 100 path = new File("/usr/share/i2p"); 101 else 102 path = new File("/etc/i2p"); 103 } else if (isDebianPackage(ctx)) { 104 path = new File("/etc/i2p"); 105 } else { 106 path = ctx.getBaseDir(); 107 } 108 path = new File(path, "wrapper.config"); 109 return path.getPath(); 110 } 84 111 } -
router/java/src/net/i2p/router/tunnel/BloomFilterIVValidator.java
r9eb3cc5 rc1b9aa9 5 5 import net.i2p.data.DataHelper; 6 6 import net.i2p.router.RouterContext; 7 import net.i2p.router.tasks.OOMListener; 7 8 import net.i2p.router.util.DecayingBloomFilter; 8 9 import net.i2p.router.util.DecayingHashSet; … … 103 104 if (SystemVersion.isAndroid()) 104 105 return; 105 // Can't find any System property or wrapper property that gives 106 // you the actual config file path, have to guess 107 String path; 108 if (SystemVersion.isLinuxService()) { 109 path = "/etc/i2p"; 110 } else { 111 path = _context.getBaseDir().toString(); 112 } 106 String path = OOMListener.getWrapperConfigPath(_context); 113 107 String msg = 114 108 "Configured for " + DataHelper.formatSize(KBps *1024L) + … … 117 111 if (_context.hasWrapper()) { 118 112 msg += " Recommend increasing wrapper.java.maxmemory in " + 119 path + File.separatorChar + "wrapper.config";113 path; 120 114 } else if (!SystemVersion.isWindows()) { 121 115 msg += " Recommend increasing MAXMEMOPT in " + 122 path+ File.separatorChar + "runplain.sh or /usr/bin/i2prouter-nowrapper";116 _context.getBaseDir() + File.separatorChar + "runplain.sh or /usr/bin/i2prouter-nowrapper"; 123 117 } else { 124 118 msg += " Recommend running the restartable version of I2P, and increasing wrapper.java.maxmemory in " + 125 path + File.separatorChar + "wrapper.config";119 path; 126 120 } 127 121 // getMaxMemory() returns significantly lower than wrapper config, so add 10%
Note: See TracChangeset
for help on using the changeset viewer.