4 Replies Latest reply on Apr 9, 2008 2:25 PM by Fernando Nasser

    failing org.jboss.test.util.test.ThreadPoolRunnableUnitTestC

    Dimitris Andreadis Master

      Re http://jira.jboss.com/jira/browse/JBAS-4160

      Was there any change in the org.jboss.util.threadpool implementation?

      Any hints as to this is failing? Thanks

        • 1. Re: failing org.jboss.test.util.test.ThreadPoolRunnableUnitT
          Scott Stark Master

          There have not been any changes, but this test uses the unreliable Thread.stop call. The call is ending with a ThreadDeath that is not being handled. Its not clear why this test would have worked in the past as BasicThreadPool.run never has handled this exception. I guess some vms are not throwing it.

          18:31:59,256 WARN [RunnableTaskWrapper] Unhandled throwable for runnable: org.jboss.test.util.test.ThreadPoolRunnableUnitTestCase$TestRunnable@be41ec
          java.lang.ThreadDeath
           at java.lang.Thread.stop(Thread.java:698)
           at org.jboss.util.threadpool.RunnableTaskWrapper.stopTask(RunnableTaskWrapper.java:122)
           at org.jboss.util.threadpool.BasicThreadPool$TimeoutInfo.stopTask(BasicThreadPool.java:517)
           at org.jboss.util.threadpool.BasicThreadPool$TimeoutMonitor.run(BasicThreadPool.java:579)
           at java.lang.Thread.run(Thread.java:595)
          



          • 2. Re: failing org.jboss.test.util.test.ThreadPoolRunnableUnitT
            Dimitris Andreadis Master

            After a painful investigation I traced that the failing test is caused by the replacement of
            "oswego-concurrent" version="1.3.4"
            with
            "oswego-concurrent" version="1.3.4-brew"

            The 2 are supposed to only differ in that the 2nd is compiled with debug=on.

            JBoss uses a thread pool, that lives in jboss common and is backed by a EDU.oswego.cs.dl.util.concurrent.PooledExecutor.

            The test that fails involves a queued task and a thread pool of size 1, executing a spinning task. The spining tasks times out, is initially interrupted and then Thread.stopped().

            In my understanding the original oswego jar makes the stopped pooled thread available to the queued task. In the debug version the pool thread seems to hung and so the remaining queued task is not executed, and the test fails.

            I don't have the time to go deeper, so I'm just rolling back the update.

            I would recommend that any brew replacements must - at a mininum - make sure they don't alter the testsuite status.

            • 3. Re: failing org.jboss.test.util.test.ThreadPoolRunnableUnitT
              Scott Stark Master

              The source is clearly different, with the brew version clearly missing two changes. This is a source tree older than 1.3.4 to be sure:

              [starksm@succubus oswego-concurrent]$ diff -w 1.3.4/lib/src/EDU/oswego/cs/dl/util/concurrent/PooledExecutor.java 1.3.4-brew/src/concurrent/PooledExecutor.java
              30,31d29
              < 30aug2003 dl check for new tasks when timing out
              < 18feb2004 dl replace dead thread if no others left
              190,193c188
              < * <dd> Wait until a thread becomes available. This
              < * policy should, in general, not be used if the minimum number of
              < * of threads is zero, in which case a thread may never become
              < * available.
              ---
              > * <dd> Wait until a thread becomes available.
              298c293
              < * <li> Same as (2) except clients abort if both the buffer is full and
              ---
              > * <li> Same as (2) except clients block if both the buffer is full and
              304c299
              < * pool.abortWhenBlocked();
              ---
              > * pool.waitWhenBlocked();
              699,709d693
              <
              < // Create a replacement if needed
              < if (poolSize_ == 0 || poolSize_ < minimumPoolSize_) {
              < try {
              < Runnable r = (Runnable)(handOff_.poll(0));
              < if (r != null && !shutdown_) // just consume task if shut down
              < addThread(r);
              < } catch(InterruptedException ie) {
              < return;
              < }
              < }
              794,797d777
              < synchronized(PooledExecutor.this) {
              < if (shutdown_)
              < return true;
              < }
              805,806c785
              < * is available, unless the pool has been shut down, in which case
              < * the action is discarded.
              ---
              > * is available.
              



              • 4. Re: failing org.jboss.test.util.test.ThreadPoolRunnableUnitT
                Fernando Nasser Newbie

                You are supposed to be using http://repository.jboss.org/oswego-concurrent/1.3.4.patch01-brew/
                which has the patches:
                concurrent-ConcurrentHashMap.patch
                concurrent-ConcurrentReaderHashMap.patch
                concurrent-PooledExecutor.patch

                I have no idea how the unpatched 1.3.4-brew ended up in Branch_4_2.

                P.S.: I myself run the testsuite after any component upgrade, -brew or not.