Program: 145461
Project: 145461
Buggy source:
@Test public void multiThreadedUpdatingRowsetTest() throws Exception {
  System.out.println("String_Node_Str");
  try (DatabasesClientWithResource resource=new DatabasesClientWithResource(settings)){
    final List<Change> commonLog=new ArrayList<>();
    final Map<String,List<Change>> changeLogs=new HashMap<>();
    changeLogs.put(null,commonLog);
    final DbClient dbClient=resource.getClient();
    Runnable clientRunnable=new Runnable(){
      @Override public void run(){
        try {
          while (!Thread.interrupted()) {
            Random rnd=new Random();
            rnd.setSeed(System.currentTimeMillis());
            int due=rnd.nextInt(10);
            try {
              Thread.sleep(due);
            }
 catch (            InterruptedException ex) {
              break;
            }
            SqlCompiledQuery query00=new SqlCompiledQuery(dbClient,"String_Node_Str");
            Rowset rowset00=query00.executeQuery();
            rowset00.setFlowProvider(new DelegatingFlowProvider(rowset00.getFlowProvider()){
              @Override public List<Change> getChangeLog(){
                return commonLog;
              }
            }
);
            rowset00.refresh();
            SqlCompiledQuery query0=new SqlCompiledQuery(dbClient,"String_Node_Str");
            Rowset rowset0=query0.executeQuery();
            rowset0.setFlowProvider(new DelegatingFlowProvider(rowset0.getFlowProvider()){
              @Override public List<Change> getChangeLog(){
                return commonLog;
              }
            }
);
            rowset0.refresh();
            SqlCompiledQuery query=new SqlCompiledQuery(dbClient,"String_Node_Str");
            query.setEntityId("String_Node_Str");
            Rowset rowset=query.executeQuery();
            rowset.setFlowProvider(new DelegatingFlowProvider(rowset.getFlowProvider()){
              @Override public List<Change> getChangeLog(){
                return commonLog;
              }
            }
);
            rowset.getFields().get("String_Node_Str").setPk(true);
            assertNotNull(rowset.getFlowProvider());
            assertTrue(rowset.getFlowProvider() instanceof DatabaseFlowProvider);
            rowset.getFields().get(1).setPk(true);
            assertTrue(rowset.size() > 0);
            rowset.beforeFirst();
            boolean rowMet=false;
            int newValue=(new Random()).nextInt();
            while (rowset.next()) {
              Integer id=rowset.getInt(rowset.getFields().find("String_Node_Str"));
              assertNotNull(id);
              if (id == 2) {
                rowMet=true;
                rowset.updateObject(rowset.getFields().find("String_Node_Str"),newValue);
              }
            }
            assertTrue(rowMet);
            dbClient.commit(changeLogs);
            assertTrue(commonLog.isEmpty());
            dbClient.dbTableChanged(null,"String_Node_Str","String_Node_Str");
          }
        }
 catch (        Exception ex) {
          boolean sleepIterrupted=(ex instanceof InterruptedException) || ((ex instanceof SQLException) && ((SQLException)ex).getCause() instanceof InterruptedException);
          if (!sleepIterrupted) {
            failedException=ex;
            Logger.getLogger(DbClientTest.class.getName()).log(Level.SEVERE,null,ex);
          }
        }
      }
    }
;
    List<Thread> threads=new ArrayList<>();
    for (int i=0; i < TEST_THREADS_COUNT; i++) {
      Thread thread=new Thread(clientRunnable);
      threads.add(thread);
    }
    for (int i=0; i < threads.size(); i++) {
      threads.get(i).start();
    }
    Thread.sleep(1000 * 120);
    int deadlessThreads=0;
    for (int i=0; i < threads.size(); i++) {
      Thread thread=threads.get(i);
      thread.interrupt();
    }
    for (int i=0; i < threads.size(); i++) {
      Thread thread=threads.get(i);
      thread.join(1000 * 20);
      if (thread.isAlive()) {
        deadlessThreads++;
        System.out.println("String_Node_Str" + String.valueOf(i) + "String_Node_Str");
      }
    }
    if (failedException != null) {
      throw failedException;
    }
    if (deadlessThreads > 0) {
      throw new Exception(String.valueOf(deadlessThreads) + "String_Node_Str");
    }
  }
 }

Fixed version (ground truth):
@Test public void multiThreadedUpdatingRowsetTest() throws Exception {
  System.out.println("String_Node_Str");
  try (DatabasesClientWithResource resource=new DatabasesClientWithResource(settings)){
    final List<Change> commonLog=new ArrayList<>();
    final Map<String,List<Change>> changeLogs=new HashMap<>();
    changeLogs.put(null,commonLog);
    final DbClient dbClient=resource.getClient();
    Runnable clientRunnable=() -> {
      try {
        while (!Thread.interrupted()) {
          Random rnd=new Random();
          rnd.setSeed(System.currentTimeMillis());
          int due=rnd.nextInt(10);
          try {
            Thread.sleep(due);
          }
 catch (          InterruptedException ex) {
            break;
          }
          SqlCompiledQuery query00=new SqlCompiledQuery(dbClient,"String_Node_Str");
          Rowset rowset00=query00.executeQuery();
          rowset00.setFlowProvider(new DelegatingFlowProvider(rowset00.getFlowProvider()){
            @Override public List<Change> getChangeLog(){
              return commonLog;
            }
          }
);
          rowset00.refresh();
          SqlCompiledQuery query0=new SqlCompiledQuery(dbClient,"String_Node_Str");
          Rowset rowset0=query0.executeQuery();
          rowset0.setFlowProvider(new DelegatingFlowProvider(rowset0.getFlowProvider()){
            @Override public List<Change> getChangeLog(){
              return commonLog;
            }
          }
);
          rowset0.refresh();
          SqlCompiledQuery query=new SqlCompiledQuery(dbClient,"String_Node_Str");
          query.setEntityId("String_Node_Str");
          Rowset rowset=query.executeQuery();
          rowset.setFlowProvider(new DelegatingFlowProvider(rowset.getFlowProvider()){
            @Override public List<Change> getChangeLog(){
              return commonLog;
            }
          }
);
          rowset.getFields().get("String_Node_Str").setPk(true);
          assertNotNull(rowset.getFlowProvider());
          assertTrue(rowset.getFlowProvider() instanceof DatabaseFlowProvider);
          rowset.getFields().get(1).setPk(true);
          assertTrue(rowset.size() > 0);
          rowset.beforeFirst();
          boolean rowMet=false;
          int newValue=(new Random()).nextInt();
          while (rowset.next()) {
            Integer id=rowset.getInt(rowset.getFields().find("String_Node_Str"));
            assertNotNull(id);
            if (id == 2) {
              rowMet=true;
              rowset.updateObject(rowset.getFields().find("String_Node_Str"),newValue);
            }
          }
          assertTrue(rowMet);
          dbClient.commit(changeLogs);
          assertTrue(commonLog.isEmpty());
          dbClient.dbTableChanged(null,"String_Node_Str","String_Node_Str");
        }
      }
 catch (      Exception ex) {
        boolean sleepIterrupted=(ex instanceof InterruptedException) || ((ex instanceof SQLException) && ((SQLException)ex).getCause() instanceof InterruptedException);
        if (!sleepIterrupted) {
          failedException=ex;
          Logger.getLogger(DbClientTest.class.getName()).log(Level.SEVERE,null,ex);
        }
      }
    }
;
    List<Thread> threads=new ArrayList<>();
    for (int i=0; i < TEST_THREADS_COUNT; i++) {
      Thread thread=new Thread(clientRunnable);
      threads.add(thread);
    }
    for (int i=0; i < threads.size(); i++) {
      threads.get(i).start();
    }
    Thread.sleep(1000 * 120);
    int deadlessThreads=0;
    for (int i=0; i < threads.size(); i++) {
      Thread thread=threads.get(i);
      thread.interrupt();
    }
    for (int i=0; i < threads.size(); i++) {
      Thread thread=threads.get(i);
      thread.join(1000 * 20);
      if (thread.isAlive()) {
        deadlessThreads++;
        System.out.println("String_Node_Str" + String.valueOf(i) + "String_Node_Str");
      }
    }
    if (failedException != null) {
      throw failedException;
    }
    if (deadlessThreads > 0) {
      throw new Exception(String.valueOf(deadlessThreads) + "String_Node_Str");
    }
  }
 }