Buggy code:
public class Thrasher { public static void main ( String [ ] args ) throws Exception { int num_hosts = 2 ; long rnd = 1 ; <START_BUG> int dcnt = 500000 ; <END_BUG> while ( ( InternalInterface . getInternalInterface ( ) . getAllHosts ( ) . length ) < num_hosts ) { Thread . sleep ( 1000 ) ; } Thrasher . TData root = new Thrasher . TData ( ) ; root . counts = new int [ num_hosts ] ; root . children = new Thrasher . TData [ 1 ] ; LinkedList < Thrasher . TData > bqueue = new LinkedList < > ( ) ; bqueue . add ( root ) ; for ( int i = 0 ; i < dcnt ; i ++ ) { Thrasher . TData parent = bqueue . poll ( ) ; Thrasher . TData d = new Thrasher . TData ( ) ; d . counts = new int [ num_hosts ] ; rnd = ( rnd * 12349798908174L ) + 11 ; d . children = new Thrasher . TData [ ( Math . abs ( ( ( ( int ) ( rnd ) ) % 5 ) ) ) + 2 ] ; bqueue . add ( d ) ; for ( int j = 0 ; j < ( parent . children . length ) ; j ++ ) { if ( ( parent . children [ j ] ) == null ) { parent . children [ j ] = d ; if ( ( j + 1 ) != ( parent . children . length ) ) bqueue . add ( parent ) ; break ; } } } int [ ] allHosts = InternalInterface . getInternalInterface ( ) . getAllHosts ( ) ; Future < Integer > [ ] callRes = new Future [ num_hosts ] ; for ( int cnt = 0 ; cnt < 30 ; cnt ++ ) { final int cntf = cnt ; System . out . println ( "inc<seq2seq4repair_space>all<seq2seq4repair_space>slots" ) ; for ( int i = 0 ; i < num_hosts ; i ++ ) { final int z = i ; callRes [ i ] = DistributedRunner . runOnRemote ( allHosts [ i ] , new Callable < Integer > ( ) { @ Override public Integer call ( ) { try { InternalInterface . getInternalInterface ( ) . debug ( ( "worker<seq2seq4repair_space>task<seq2seq4repair_space>starting:<seq2seq4repair_space>" + z ) ) ; incSlot ( root , z ) ; return z ; } catch ( Throwable e ) { e . printStackTrace ( ) ; throw e ; } } int c = 0 ; private void incSlot ( Thrasher . TData n , int slot ) { if ( n == null ) return ; if ( ( ( ++ ( c ) ) % 200 ) == 0 ) { InternalInterface . getInternalInterface ( ) . debug ( ( ( ( "worker<seq2seq4repair_space>task<seq2seq4repair_space>" + z ) + "<seq2seq4repair_space>at<seq2seq4repair_space>" ) + ( c ) ) ) ; } ( n . counts [ slot ] ) ++ ; for ( int j = 0 ; j < ( n . children . length ) ; j ++ ) { incSlot ( n . children [ j ] , slot ) ; } } } ) ; } System . out . println ( "waiting<seq2seq4repair_space>on<seq2seq4repair_space>all<seq2seq4repair_space>worker<seq2seq4repair_space>threads" ) ; for ( int i = 0 ; i < num_hosts ; i ++ ) { callRes [ i ] . get ( ) ; } System . out . println ( "checking<seq2seq4repair_space>value<seq2seq4repair_space>of<seq2seq4repair_space>all<seq2seq4repair_space>slots" ) ; for ( int i = 0 ; i < num_hosts ; i ++ ) { final int v = ( i + 1 ) % num_hosts ; callRes [ i ] = DistributedRunner . runOnRemote ( allHosts [ i ] , new Callable < Integer > ( ) { @ Override public Integer call ( ) throws Exception { InternalInterface . getInternalInterface ( ) . debug ( ( "checker<seq2seq4repair_space>task<seq2seq4repair_space>starting:<seq2seq4repair_space>" + v ) ) ; try { return checkSlot ( root , v , ( cntf + 1 ) ) ; } catch ( Throwable e ) { e . printStackTrace ( ) ; throw e ; } } int c = 0 ; private int checkSlot ( Thrasher . TData n , int slot , int val ) { if ( n == null ) return 0 ; if ( ( ( ( c ) ++ ) % 200 ) == 0 ) { InternalInterface . getInternalInterface ( ) . debug ( ( ( ( "checker<seq2seq4repair_space>task<seq2seq4repair_space>" + v ) + "<seq2seq4repair_space>at<seq2seq4repair_space>" ) + ( c ) ) ) ; } int r = 0 ; if ( ( n . counts [ slot ] ) != val ) { r ++ ; System . out . println ( ( ( ( "Failed<seq2seq4repair_space>when<seq2seq4repair_space>checking<seq2seq4repair_space>slot<seq2seq4repair_space>" + slot ) + "<seq2seq4repair_space>on<seq2seq4repair_space>instance:<seq2seq4repair_space>" ) + n ) ) ; } for ( int j = 0 ; j < ( n . children . length ) ; j ++ ) { r += checkSlot ( n . children [ j ] , slot , val ) ; } return r ; } } ) ; } System . out . println ( "waiting<seq2seq4repair_space>on<seq2seq4repair_space>all<seq2seq4repair_space>checking<seq2seq4repair_space>worker<seq2seq4repair_space>threads" ) ; int failed = 0 ; for ( int i = 0 ; i < num_hosts ; i ++ ) { Future < Integer > ff = null ; Integer vv = null ; int mode = 0 ; int mode2 = 0 ; try { ff = callRes [ i ] ; mode = ( ( ObjectBase ) ( ff ) ) . __dj_class_mode ; vv = ff . get ( ) ; mode2 = ( ( ObjectBase ) ( ff ) ) . __dj_class_mode ; failed += vv ; } catch ( NullPointerException e ) { e . printStackTrace ( ) ; System . err . println ( ff ) ;

Fix:
int dcnt = 5000 ;