0 Replies Latest reply on Nov 27, 2008 10:34 AM by Adrian Brock

    TxConnectionManagerStressCase

    Adrian Brock Master

      This test keeps failing randomly.

      I'm not entirely sure what this is actually trying to test,
      it appears to be only failing if the tx timeout doesn't occur?

      // Only code that sets failed = true
      
       Transaction tx = tm.getTransaction();
       if (tx != null && TxUtils.isActive(tx))
       failed = true;
      
      // Other places that trap an error but don't set failed
      
       catch (ResourceException re)
       {
       error = re;
       log.info(re.getMessage(), re);
       }
      
      // Test only fails if failed is set (which isn't thread safe anyway!)
       assertTrue("Error in timeout test: " + error, !failed);
      


      Anyway the reason why it is failing randomly is because giving only 500ms
      for 100 threads to have their transactions timed out isn't going to work
      if the server where the test is running is busy doing something else with its cpu.

      I'm going to fix this test so that instead of using a Thread.wait()
      it registers a transaction synchronization to do a more predicatble handoff
      between the transaction timeout and whatever the test is trying to do.

      While I'm there I'm going to fix the test so that it tidies up the thread transaction
      association. The only reason that isn't an issue currently is because
      each thread only goes through one iteration.

      I'll leave it to you Jesper to figure out whether this test is actually testing what
      it is supposed to be testing. ;-)