Buggy code:
private static final long MEASURED_INTERVAL = ( OutboundTcpConnection . TimeHorizonMovingAverageCoalescingStrategy . BUCKET_INTERVAL ) * ( ( OutboundTcpConnection . TimeHorizonMovingAverageCoalescingStrategy . BUCKET_COUNT ) - 1 ) ; private long epoch = System . nanoTime ( ) ; private final int [ ] samples = new int [ OutboundTcpConnection . TimeHorizonMovingAverageCoalescingStrategy . BUCKET_COUNT ] ; private long sum = 0 ; private final long maxCoalesceWindow ; public TimeHorizonMovingAverageCoalescingStrategy ( int maxCoalesceWindow ) { } private void logSample ( long nanos ) { } private long averageGap ( ) { } public boolean maybeSleep ( int messages ) { } private long rollepoch ( long delta , long epoch , long nanos ) { } private long epoch ( long latestNanos ) { } private int ix ( long nanos ) { } volatile boolean shouldLogAverage = false ; @ Override public void coalesce ( BlockingQueue < OutboundTcpConnection . QueuedMessage > input , List < OutboundTcpConnection . QueuedMessage > out , int outSize ) throws InterruptedException { } } @ VisibleForTesting static class MovingAverageCoalescingStrategy implements OutboundTcpConnection . CoalescingStrategy { private final int [ ] samples = new int [ 16 ] ; private long lastSample = 0 ; private int index = 0 ; private long sum = 0 ; private final long maxCoalesceWindow ; private long coalesceDecision = - 1 ; public MovingAverageCoalescingStrategy ( int maxCoalesceWindow ) { } private long logSample ( int value ) { } private long notifyOfSample ( long sample ) { } volatile boolean shouldLogAverage = false ; @ Override public void coalesce ( BlockingQueue < OutboundTcpConnection . QueuedMessage > input , List < OutboundTcpConnection . QueuedMessage > out , int outSize ) throws InterruptedException { } } @ VisibleForTesting static class FixedCoalescingStrategy implements OutboundTcpConnection . CoalescingStrategy { private final long coalesceWindow ; public FixedCoalescingStrategy ( int coalesceWindowMicros ) { } @ Override public void coalesce ( BlockingQueue < OutboundTcpConnection . QueuedMessage > input , List < OutboundTcpConnection . QueuedMessage > out , int outSize ) throws InterruptedException { } } @ VisibleForTesting static class DisabledCoalescingStrategy implements OutboundTcpConnection . CoalescingStrategy { @ Override public void coalesce ( BlockingQueue < OutboundTcpConnection . QueuedMessage > input , List < OutboundTcpConnection . QueuedMessage > out , int outSize ) throws InterruptedException { } } @ VisibleForTesting static class DisabledBrokenCoalescingStrategy implements OutboundTcpConnection . CoalescingStrategy { @ Override public void coalesce ( BlockingQueue < OutboundTcpConnection . QueuedMessage > input , List < OutboundTcpConnection . QueuedMessage > out , int outSize ) throws InterruptedException { } } private static OutboundTcpConnection . CoalescingStrategy newCoalescingStrategy ( ) { } private static final MessageOut CLOSE_SENTINEL = new MessageOut ( Verb . INTERNAL_RESPONSE ) ; private volatile boolean isStopped = false ; private static final int OPEN_RETRY_DELAY = 100 ; public static final int WAIT_FOR_VERSION_MAX_TIME = 5000 ; private static final int NO_VERSION = Integer . MIN_VALUE ; static final int LZ4_HASH_SEED = - 1756908916 ; private final BlockingQueue < OutboundTcpConnection . QueuedMessage > backlog = new LinkedBlockingQueue < > ( ) ; private final OutboundTcpConnectionPool poolReference ; private final OutboundTcpConnection . CoalescingStrategy cs = OutboundTcpConnection . newCoalescingStrategy ( ) ; private DataOutputStreamPlus out ; private Socket socket ; private volatile long completed ; private final AtomicLong dropped = new AtomicLong ( ) ; private volatile int currentMsgBufferCount = 0 ; private int targetVersion ; public OutboundTcpConnection ( OutboundTcpConnectionPool pool ) { } private static boolean isLocalDC ( InetAddress targetHost ) { } public void enqueue ( MessageOut < ? > message , int id ) { } void closeSocket ( boolean destroyThread ) { } void softCloseSocket ( ) { } public int getTargetVersion ( ) { } public void run ( ) { ByteBuffer logBuffer = null ; RandomAccessFile ras = null ; if ( OutboundTcpConnection . DEBUG_COALESCING ) { try { <START_BUG> File outFile = File . createTempFile ( ( ( "sillylog_" + ( poolReference . endPoint ( ) . getHostAddress ( ) ) ) + "_" ) , ".log" ) ; <END_BUG> ras = new RandomAccessFile ( "//tmp//sillylog" , "rw" ) ; logBuffer = ras . getChannel ( ) . map ( FileChannel . MapMode . READ_WRITE , 0 , Integer . MAX_VALUE ) ; logBuffer . order ( ByteOrder . LITTLE_ENDIAN ) ; logBuffer . putLong ( 0 ) ; } catch ( Exception e ) { OutboundTcpConnection . logger . error ( "ouch" , e ) ; } } final int drainedMessageSize = 128 ; final List < OutboundTcpConnection . QueuedMessage > drainedMessages = new ArrayList < > ( drainedMessageSize ) ; outer : while ( true ) { try { cs . coalesce ( backlog , drainedMessages , drainedMessageSize ) ; } catch ( InterruptedException e ) { throw new AssertionError ( e ) ; } currentMsgBufferCount = drainedMessages . size ( ) ; int count = drainedMessages . size ( ) ; for ( OutboundTcpConnection . QueuedMessage qm : drainedMessages ) { if ( logBuffer != null ) { logBuffer . putLong ( 0 , ( ( logBuffer . getLong ( 0 ) ) + 1 ) ) ; logBuffer . putLong ( qm . timestampNanos ) ; } try { MessageOut < ? > m = qm . message ; if ( m == ( OutboundTcpConnection . CLOSE_SENTINEL ) ) { disconnect ( ) ; if ( isStopped ) break outer ; continue ; } if ( qm . isTimedOut ( TimeUnit . MILLISECONDS . toNanos ( m . getTimeout ( ) ) , System . nanoTime ( ) ) ) dropped . incrementAndGet ( ) ; else if ( ( ( socket ) != null ) || ( connect ( ) ) ) writeConnected ( qm , ( ( count == 1 ) && ( backlog . isEmpty ( ) ) ) ) ; else backlog . clear ( ) ; } catch ( Exception e ) { JVMStabilityInspector . inspectThrowable ( e ) ; OutboundTcpConnection . logger . error ( "error<seq2seq4repair_space>processing<seq2seq4repair_space>a<seq2seq4repair_space>message<seq2seq4repair_space>intended<seq2seq4repair_space>for<seq2seq4repair_space>{}" , poolReference . endPoint ( ) , e ) ;

Fix:
File outFile = File . createTempFile ( ( ( "sillylog_" + ( poolReference . endPoint ( ) . getHostAddress ( ) ) ) + "_" ) , ".log" , new File ( "//tmp//sillylogs" ) ) ;