• Dave Cridland's avatar
    OF-115 Remove race during outgoing session creation · d0667e21
    Dave Cridland authored
    This one is hard to duplicate in the lab, so this may not actually cure the
    issue, however I suspect it does.
    
    The existing code is based around a route of last resort, the
    OutgoingSessionPromise, which builds a helper - the PacketsProcessor - and
    creates the new session. The PacketsProcessors operate from within a thread
    pool, and thus have contended execution time.
    
    As new packets arrives from onward transmission during the session setup, the
    PacketsProcessor queues them for retransmission. However, the act of session
    creation also creates the outgoing route, meaning that later packets will
    bypass the queue, and be transmitted out of order.
    
    This should give the impression of a randomly reordered set of stanzas, but
    would in fact be two consecutive sequences of ordered stanzas which are
    interleaved, hence if the two sequences are A-E, F-J, one might see:
    
    A, B, F, G, C, H, I, D, J, E
    
    The fix here is two ensure that all packets are queued until the queue itself
    is empty. In the solution provided, an additional helper class acts as the
    route's RoutableChannelHandler, and stores packets in a queue until the real
    ServerSession can catch up with the pending traffic. After that it simply
    passes the process() call argument through.
    d0667e21
RoutingTableImpl.java 47.1 KB