Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8144798

An unexpected error is thrown when removing from a LinkedList

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.8.0_65"
      Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Darwin XXXXX-MacBook-Pro.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64

      A DESCRIPTION OF THE PROBLEM :
      I am using a LinkedList in a thread. Often when removing (LinkedList.removeFirst()) an object from the LinkedList an exception is thrown. The error is shown below. I have verified that the LinkedList is not empty when trying to remove an object.

      Exception in thread "Thread-0" java.util.NoSuchElementException
      at java.util.LinkedList.removeFirst(LinkedList.java:270)
      at Mediator.run(simRaymond_mod_20151029.java:212)


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "Thread-0" java.util.NoSuchElementException
      at java.util.LinkedList.removeFirst(LinkedList.java:270)
      at Mediator.run(simRaymond_mod_20151029.java:212)

      REPRODUCIBILITY :
      This bug can be reproduced often.

      CUSTOMER SUBMITTED WORKAROUND :
      I have tried changing the LinkedList to an ArrayList but that hangs often as well. It will not always throw an exception but it will hang.

            forax Rémi Forax
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: