Buggy code:
public class TridentBoltExecutor implements IRichBolt { public static String COORD_STREAM_PREFIX = "$coord-" ; public static String COORD_STREAM ( String batch ) { } public static class CoordType implements Serializable { public boolean singleCount ; protected CoordType ( boolean singleCount ) { } public static TridentBoltExecutor . CoordType single ( ) { } public static TridentBoltExecutor . CoordType all ( ) { } @ Override public boolean equals ( Object o ) { } @ Override public String toString ( ) { } } public static class CoordSpec implements Serializable { public GlobalStreamId commitStream = null ; public Map < String , TridentBoltExecutor . CoordType > coords = new HashMap < String , TridentBoltExecutor . CoordType > ( ) ; public CoordSpec ( ) { } } public static class CoordCondition implements Serializable { public GlobalStreamId commitStream ; public int expectedTaskReports ; Set < Integer > targetTasks ; @ Override public String toString ( ) { } } Map < GlobalStreamId , String > _batchGroupIds ; Map < String , TridentBoltExecutor . CoordSpec > _coordSpecs ; Map < String , TridentBoltExecutor . CoordCondition > _coordConditions ; ITridentBatchBolt _bolt ; long _messageTimeoutMs ; long _lastRotate ; RotatingMap _batches ; public TridentBoltExecutor ( ITridentBatchBolt bolt , Map < GlobalStreamId , String > batchGroupIds , Map < String , TridentBoltExecutor . CoordSpec > coordinationSpecs ) { } public static class TrackedBatch { int attemptId ; BatchInfo info ; TridentBoltExecutor . CoordCondition condition ; int reportedTasks = 0 ; int expectedTupleCount = 0 ; int receivedTuples = 0 ; Map < Integer , Integer > taskEmittedTuples = new HashMap ( ) ; boolean failed = false ; boolean receivedCommit ; Tuple delayedAck = null ; public TrackedBatch ( BatchInfo info , TridentBoltExecutor . CoordCondition condition , int attemptId ) { } @ Override public String toString ( ) { } } public class CoordinatedOutputCollector implements IOutputCollector { IOutputCollector _delegate ; TridentBoltExecutor . TrackedBatch _currBatch = null ; public void setCurrBatch ( TridentBoltExecutor . TrackedBatch batch ) { } public CoordinatedOutputCollector ( IOutputCollector delegate ) { } public List < Integer > emit ( String stream , Collection < Tuple > anchors , List < Object > tuple ) { } public void emitDirect ( int task , String stream , Collection < Tuple > anchors , List < Object > tuple ) { } public void ack ( Tuple tuple ) { } public void fail ( Tuple tuple ) { } public void reportError ( Throwable error ) { } private void updateTaskCounts ( List < Integer > tasks ) { } } OutputCollector _collector ; TridentBoltExecutor . CoordinatedOutputCollector _coordCollector ; BatchOutputCollector _coordOutputCollector ; TopologyContext _context ; @ Override public void prepare ( Map conf , TopologyContext context , OutputCollector collector ) { } private void failBatch ( TridentBoltExecutor . TrackedBatch tracked , FailedException e ) { } private void failBatch ( TridentBoltExecutor . TrackedBatch tracked ) { } private boolean finishBatch ( TridentBoltExecutor . TrackedBatch tracked , Tuple finishTuple ) { } private void checkFinish ( TridentBoltExecutor . TrackedBatch tracked , Tuple tuple , TridentBoltExecutor . TupleType type ) { } @ Override public void execute ( Tuple tuple ) { <START_BUG> if ( tuple . getSourceStreamId ( ) . equals ( Constants . SYSTEM_TICK_STREAM_ID ) ) { <END_BUG> long now = System . currentTimeMillis ( ) ; if ( ( now - ( _lastRotate ) ) > ( _messageTimeoutMs ) ) { _batches . rotate ( ) ; _lastRotate = now ; } return ; } String batchGroup = _batchGroupIds . get ( tuple . getSourceGlobalStreamid ( ) ) ; if ( batchGroup == null ) { _coordCollector . setCurrBatch ( null ) ; _bolt . execute ( null , tuple ) ; _collector . ack ( tuple ) ; return ; } IBatchID id = ( ( IBatchID ) ( tuple . getValue ( 0 ) ) ) ; TridentBoltExecutor . TrackedBatch tracked = ( ( TridentBoltExecutor . TrackedBatch ) ( _batches . get ( id . getId ( ) ) ) ) ; if ( tracked != null ) { if ( ( id . getAttemptId ( ) ) > ( tracked . attemptId ) ) { _batches . remove ( id . getId ( ) ) ; tracked = null ; } else if ( ( id . getAttemptId ( ) ) < ( tracked . attemptId ) ) { return ; } } if ( tracked == null ) { tracked = new TridentBoltExecutor . TrackedBatch ( new BatchInfo ( batchGroup , id , _bolt . initBatchState ( batchGroup , id ) ) , _coordConditions . get ( batchGroup ) , id . getAttemptId ( ) ) ; _batches . put ( id . getId ( ) , tracked ) ; } _coordCollector . setCurrBatch ( tracked ) ; TridentBoltExecutor . TupleType t = getTupleType ( tuple , tracked ) ; if ( t == ( TridentBoltExecutor . TupleType . COMMIT ) ) { tracked . receivedCommit = true ; checkFinish ( tracked , tuple , t ) ; } else if ( t == ( TridentBoltExecutor . TupleType . COORD ) ) { int count = tuple . getInteger ( 1 ) ; ( tracked . reportedTasks ) ++ ; tracked . expectedTupleCount += count ; checkFinish ( tracked , tuple , t ) ; } else { ( tracked . receivedTuples ) ++ ; boolean success = true ; try { _bolt . execute ( tracked . info , tuple ) ; if ( ( tracked . condition . expectedTaskReports ) == 0 ) { success = finishBatch ( tracked , tuple ) ; } } catch ( FailedException e ) { failBatch ( tracked , e ) ; } if ( success ) { _collector . ack ( tuple ) ; } else { _collector . fail ( tuple ) ; } } _coordCollector . setCurrBatch ( null ) ; } @ Override public void cleanup ( ) { }

Fix:
if ( tuple . isTick ( ) ) {