Changeset 1368548


Ignore:
Timestamp:
May 4, 2016 11:43:47 AM (5 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
cdafab27
Parents:
cb2790b
Message:

Utils: Fix bug in periodic timers triggered by
a backwards clock shift, caused graphs to be blank
and various router, streaming, and i2ptunnel
degradations over time (ticket #1776)
Log tweaks

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/util/SimpleTimer2.java

    rcb2790b r1368548  
    254254
    255255        /** state of the current event.  All access should be under lock. */
    256         private TimedEventState _state;
     256        protected TimedEventState _state;
    257257        /** absolute time this event should run next time. LOCKING: this */
    258258        private long _nextRun;
     
    339339        public synchronized void reschedule(long timeoutMs, boolean useEarliestTime) {
    340340            if (timeoutMs <= 0) {
    341                 if (timeoutMs < 0 && _log.shouldWarn())
    342                     _log.warn("Resched. timeout < 0: " + this + " timeout = " + timeoutMs + " state: " + _state);
     341                if (timeoutMs < 0 && _log.shouldInfo())
     342                    _log.info("Resched. timeout < 0: " + this + " timeout = " + timeoutMs + " state: " + _state);
    343343                timeoutMs = 1;
    344344            }
     
    424424            synchronized(this) {
    425425                if (Thread.currentThread().isInterrupted()) {
    426                     _log.warn("I was interrupted in run, state "+_state+" event "+this);
     426                    if (_log.shouldWarn())
     427                        _log.warn("I was interrupted in run, state "+_state+" event "+this);
    427428                    return;
    428429                }
     
    432433                switch(_state) {
    433434                  case CANCELLED:
     435                      if (_log.shouldInfo())
     436                          _log.info("Not actually running: CANCELLED " + this);
    434437                    return; // goodbye
    435438                  case IDLE:  // fall through
     
    445448                    // proceed, switch to IDLE to reschedule
    446449                    _state = TimedEventState.IDLE;
     450                    if (_log.shouldInfo())
     451                        _log.info("Early execution, Rescheduling for " + difference + " later: " + this);
    447452                    schedule(difference);
    448453                    return;
     
    486491                            if (_rescheduleAfterRun) {
    487492                                _rescheduleAfterRun = false;
     493                                if (_log.shouldInfo())
     494                                    _log.info("Reschedule after run: " + this);
    488495                                schedule(_nextRun - System.currentTimeMillis());
    489496                            }
     
    495502            if (time > 500 && _log.shouldLog(Log.WARN))
    496503                _log.warn(_pool + " event execution took " + time + ": " + this);
     504            else if (_log.shouldDebug())
     505                _log.debug("Execution finished in " + time + ": " + this);
    497506            if (_log.shouldLog(Log.INFO)) {
    498507                 // this call is slow - iterates through a HashMap -
     
    538547     */
    539548    private static abstract class PeriodicTimedEvent extends TimedEvent {
    540         private long _timeoutMs;
     549        private final long _timeoutMs;
    541550       
    542551        /**
     
    557566        public void run() {
    558567            super.run();
    559             schedule(_timeoutMs);
     568            synchronized(this) {
     569                // Task may have rescheduled itself without actually running.
     570                // If we schedule again, it will be stuck in a scheduling loop.
     571                // This happens after a backwards clock shift.
     572                if (_state == TimedEventState.IDLE)
     573                    schedule(_timeoutMs);
     574            }
    560575        }
    561576    }
  • history.txt

    rcb2790b r1368548  
     12016-05-04 zzz
     2 * Utils: Fix bug in periodic timers triggered by
     3   a backwards clock shift, caused graphs to be blank
     4   and various router, streaming, and i2ptunnel
     5   degradations over time (ticket #1776)
     6
     72016-05-01 zzz
     8 * Build: Compile resource bundles from ant, not msgfmt,
     9   speeding up builds with translations by 20x
     10 * Debian: Back out libhttpclient-java dependency,
     11   requires 4.4 which is too recent for most distros
     12
     132016-04-30 zzz
     14 * Blocklist: Add RFC 6598 addresses
     15 * Console:
     16   - Only display cpuid information on x86
     17   - Readme page link fixes (tickets #1789, #1790)
     18 * Data: Fix NPE calculating the hash of a RI of unknown sig type
     19 * Debian:
     20   - Add runtime dependency on libhttpclient-java,
     21     link to /usr/share/java/httpclient.jar and httpcore.jar
     22 * Eepsite: comment out gzip filtering in cgi context,
     23   causes hung threads, root cause unknown
     24 * Router: Reduce log level of RI sig failure
     25 * SAM: Log tweaks (ticket #1778)
     26
    1272016-04-29 zzz
    228 * Debian:
  • router/java/src/net/i2p/router/RouterVersion.java

    rcb2790b r1368548  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 8;
     21    public final static long BUILD = 9;
    2222
    2323    /** for example "-test" */
Note: See TracChangeset for help on using the changeset viewer.