Uploaded image for project: 'Droids'
  1. Droids
  2. DROIDS-166

SimpleTaskQueueWithHistory is not thread safe

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.2.0
    • 0.2.0
    • core
    • None

    Description

      The implementation extends java.util.LinkedList which is not thread safe.
      Running droids with the MultiThreadedTaskMaster could spawn endless new threads.

      Exception in thread "pool-1-thread-12808" java.util.NoSuchElementException
              at java.util.LinkedList.remove(LinkedList.java:788)
              at java.util.LinkedList.removeFirst(LinkedList.java:134)
              at java.util.LinkedList.poll(LinkedList.java:470)
              at org.apache.droids.impl.MultiThreadedTaskMaster$TaskExecutor.run(MultiThreadedTaskMaster.java:336)
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
              at java.lang.Thread.run(Thread.java:662)
      
      

      I fixed this extending the SimpleTaskQueueWithHistory from java.util.concurrent.LinkedBlockingQueue and rewriting the add and offer methods.

      Attachments

        1. DROIDS-166.patch
          2 kB
          Tobias Rübner

        Activity

          People

            Unassigned Unassigned
            tobr Tobias Rübner
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: