propagate from branch 'i2p.i2p.zzz.test' (head be1a2452acf68a8a0137f98f5aeb797055321d6e)
to branch 'i2p.i2p' (head bd6b02d1ae8a99afcea7fdffedf699a6e5c85fbf)
This commit is contained in:
@ -49,11 +49,15 @@ class RouterWatchdog implements Runnable {
|
||||
}
|
||||
|
||||
private boolean shutdownOnHang() {
|
||||
// prop default true
|
||||
if (!Boolean.valueOf(_context.getProperty("watchdog.haltOnHang", "true")).booleanValue())
|
||||
return false;
|
||||
|
||||
// Client manager starts complaining after 10 minutes, and we run every minute,
|
||||
// so this will restart 20 minutes after we lose a lease, if the wrapper is present.
|
||||
if (_consecutiveErrors >= 10 && System.getProperty("wrapper.version") != null)
|
||||
// so this will restart 30 minutes after we lose a lease, if the wrapper is present.
|
||||
if (_consecutiveErrors >= 20 && System.getProperty("wrapper.version") != null)
|
||||
return true;
|
||||
return Boolean.valueOf(_context.getProperty("watchdog.haltOnHang", "false")).booleanValue();
|
||||
return false;
|
||||
}
|
||||
|
||||
private void dumpStatus() {
|
||||
@ -90,13 +94,14 @@ class RouterWatchdog implements Runnable {
|
||||
long used = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
|
||||
_log.error("Memory: " + DataHelper.formatSize(used) + '/' + DataHelper.formatSize(max));
|
||||
if (_consecutiveErrors == 1) {
|
||||
_log.log(Log.CRIT, "Router appears hung! Will restart in 20 minutes if it doesn't fix itself");
|
||||
// This might work on linux...
|
||||
// It won't on windows, and we can't call i2prouter.bat either, it does something
|
||||
// completely different...
|
||||
ShellCommand sc = new ShellCommand();
|
||||
boolean success = sc.executeSilentAndWaitTimed("./i2prouter dump", 10);
|
||||
if (success)
|
||||
_log.error("DUMPED THREADS TO WRAPPER LOG");
|
||||
_log.log(Log.CRIT, "Threads dumped to wrapper log");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -127,7 +132,7 @@ class RouterWatchdog implements Runnable {
|
||||
_consecutiveErrors++;
|
||||
dumpStatus();
|
||||
if (shutdownOnHang()) {
|
||||
_log.log(Log.CRIT, "Router hung! hard restart!");
|
||||
_log.log(Log.CRIT, "Router hung! Restart forced by watchdog!");
|
||||
try { Thread.sleep(30*1000); } catch (InterruptedException ie) {}
|
||||
// halt and not system.exit, since some of the shutdown hooks might be misbehaving
|
||||
Runtime.getRuntime().halt(Router.EXIT_HARD_RESTART);
|
||||
|
@ -87,9 +87,14 @@ public class StatisticsManager implements Service {
|
||||
|
||||
if (_includePeerRankings) {
|
||||
long publishedUptime = _context.router().getUptime();
|
||||
boolean commentOutIn074 = RouterVersion.VERSION.equals("0.7.3");
|
||||
// Don't publish these for first hour
|
||||
if (publishedUptime > 60*60*1000)
|
||||
includeThroughput(stats);
|
||||
if (publishedUptime > 62*60*1000) {
|
||||
if (commentOutIn074)
|
||||
includeThroughput(stats);
|
||||
else
|
||||
includeAverageThroughput(stats);
|
||||
}
|
||||
//includeRate("router.invalidMessageTime", stats, new long[] { 10*60*1000 });
|
||||
//includeRate("router.duplicateMessageId", stats, new long[] { 24*60*60*1000 });
|
||||
//includeRate("tunnel.duplicateIV", stats, new long[] { 24*60*60*1000 });
|
||||
@ -223,16 +228,26 @@ public class StatisticsManager implements Service {
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/* report the same data for tx and rx, for enhanced anonymity */
|
||||
private void includeAverageThroughput(Properties stats) {
|
||||
RateStat sendRate = _context.statManager().getRate("bw.sendRate");
|
||||
RateStat recvRate = _context.statManager().getRate("bw.recvRate");
|
||||
if (sendRate == null || recvRate == null)
|
||||
return;
|
||||
Rate s = sendRate.getRate(60*60*1000);
|
||||
Rate r = recvRate.getRate(60*60*1000);
|
||||
if (s == null || r == null)
|
||||
return;
|
||||
double speed = (s.getAverageValue() + r.getAverageValue()) / 2;
|
||||
double max = Math.max(s.getExtremeAverageValue(), r.getExtremeAverageValue());
|
||||
String str = num(speed) + ';' + num(max) + ";0;0;";
|
||||
stats.setProperty("stat_bandwidthSendBps.60m", str);
|
||||
stats.setProperty("stat_bandwidthReceiveBps.60m", str);
|
||||
}
|
||||
|
||||
private void includeThroughput(Properties stats) {
|
||||
RateStat sendRate = _context.statManager().getRate("bw.sendRate");
|
||||
if (sendRate != null) {
|
||||
/****
|
||||
if (_context.router().getUptime() > 5*60*1000) {
|
||||
Rate r = sendRate.getRate(5*60*1000);
|
||||
if (r != null)
|
||||
stats.setProperty("stat_bandwidthSendBps.5m", num(r.getAverageValue()) + ';' + num(r.getExtremeAverageValue()) + ";0;0;");
|
||||
}
|
||||
****/
|
||||
if (_context.router().getUptime() > 60*60*1000) {
|
||||
Rate r = sendRate.getRate(60*60*1000);
|
||||
if (r != null)
|
||||
@ -242,13 +257,6 @@ public class StatisticsManager implements Service {
|
||||
|
||||
RateStat recvRate = _context.statManager().getRate("bw.recvRate");
|
||||
if (recvRate != null) {
|
||||
/****
|
||||
if (_context.router().getUptime() > 5*60*1000) {
|
||||
Rate r = recvRate.getRate(5*60*1000);
|
||||
if (r != null)
|
||||
stats.setProperty("stat_bandwidthReceiveBps.5m", num(r.getAverageValue()) + ';' + num(r.getExtremeAverageValue()) + ";0;0;");
|
||||
}
|
||||
****/
|
||||
if (_context.router().getUptime() > 60*60*1000) {
|
||||
Rate r = recvRate.getRate(60*60*1000);
|
||||
if (r != null)
|
||||
|
@ -100,8 +100,10 @@ class FloodOnlySearchJob extends FloodSearchJob {
|
||||
if (floodfillPeers.size() <= 3)
|
||||
_shouldProcessDSRM = true;
|
||||
if (floodfillPeers.size() <= 0) {
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
_log.error("Running netDb searches against the floodfill peers, but we don't know any");
|
||||
// ask anybody, they may not return the answer but they will return a few ff peers we can go look up,
|
||||
// so this situation should be temporary
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Running netDb searches against the floodfill peers, but we don't know any");
|
||||
floodfillPeers = new ArrayList(_facade.getAllRouters());
|
||||
if (floodfillPeers.size() <= 0) {
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
|
@ -8,6 +8,12 @@ import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* Ask the peer who sent us the DSRM for the RouterInfos.
|
||||
*
|
||||
* If we have the routerInfo already, try to refetch it from that router itself,
|
||||
* if we aren't already connected to that router,
|
||||
* which will help us establish that router as a good floodfill and speed our
|
||||
* integration into the network.
|
||||
*
|
||||
* A simple version of SearchReplyJob in SearchJob.java.
|
||||
* Skip the profile updates - this should be rare.
|
||||
*
|
||||
@ -28,6 +34,8 @@ class SingleLookupJob extends JobImpl {
|
||||
continue;
|
||||
if (getContext().netDb().lookupRouterInfoLocally(peer) == null)
|
||||
getContext().jobQueue().addJob(new SingleSearchJob(getContext(), peer, from));
|
||||
else if (!getContext().commSystem().isEstablished(peer))
|
||||
getContext().jobQueue().addJob(new SingleSearchJob(getContext(), peer, peer));
|
||||
}
|
||||
}
|
||||
public String getName() { return "NetDb process DSRM"; }
|
||||
|
@ -34,8 +34,14 @@ public class FIFOBandwidthRefiller implements Runnable {
|
||||
//public static final String PROP_REPLENISH_FREQUENCY = "i2np.bandwidth.replenishFrequencyMs";
|
||||
|
||||
// no longer allow unlimited bandwidth - the user must specify a value, else use defaults below (KBps)
|
||||
public static final int DEFAULT_INBOUND_BANDWIDTH = 64;
|
||||
public static final int DEFAULT_OUTBOUND_BANDWIDTH = 32;
|
||||
public static final int DEFAULT_INBOUND_BANDWIDTH = 96;
|
||||
/**
|
||||
* Caution, do not make DEFAULT_OUTBOUND_BANDWIDTH * DEFAULT_SHARE_PCT > 32
|
||||
* without thinking about the implications (default connection limits, for example)
|
||||
* of moving the default bandwidth class from L to M, or maybe
|
||||
* adjusting bandwidth class boundaries.
|
||||
*/
|
||||
public static final int DEFAULT_OUTBOUND_BANDWIDTH = 40;
|
||||
public static final int DEFAULT_INBOUND_BURST_BANDWIDTH = 80;
|
||||
public static final int DEFAULT_OUTBOUND_BURST_BANDWIDTH = 40;
|
||||
|
||||
|
Reference in New Issue
Block a user