Uploaded image for project: 'XNIO'
  1. XNIO
  2. XNIO-304

WorkerThread work queue synchronisation issue

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 3.5.2.Final
    • None
    • None
    • None

      I am observing a process that doesn't seem to have "seen" that a task was added to the queue so calls select and gets stuck.
      This is a very small window, workerThread is unscheduled just before to call polling = true. Another scheduled thread that is adding a task would see polling field to be false so not calling wakeup. So when the workerThread get scheduled, if we unsynchronized workQueue.peek() can return null although an element has been added by another thread.

      I have written a simple reproducer (no XNIO, just queue and threads), and it makes it clear that no properly synchronised peek gets you invalid content. The test case has been attached, just uncomment the synchronised block and you will get a stuck thread.

              jdenise@redhat.com Jean Francois Denise
              jdenise@redhat.com Jean Francois Denise
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: