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

NPE happens on ByteBufferSlicePool.clean() for non-direct buffers

    XMLWordPrintable

Details

    • Hide

      1. Configure direct-buffers="false" on <buffer-pool> in the io subsystem:

      /subsystem=io/buffer-pool=default:write-attribute(name=direct-buffers,value=false)
      :reload
      

      2. Shutdown JBoss EAP 7

      Then, you will see NullPointerException on XNIO ByteBufferSlicePool.clean().

      Show
      1. Configure direct-buffers="false" on <buffer-pool> in the io subsystem: /subsystem=io/buffer-pool= default :write-attribute(name=direct-buffers,value= false ) :reload 2. Shutdown JBoss EAP 7 Then, you will see NullPointerException on XNIO ByteBufferSlicePool.clean().

    Description

      The following NPE happens on XNIO ByteBufferSlicePool.clean() for non-direct buffers during the shutdown. For example, when direct-buffers="false" is specified to <buffer-pool> in the io subsystem.

      10:02:08,180 WARN  [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000004: Failure during stop of service org.wildfly.io.buffer-pool.default: java.lang.NullPointerException
      	at java.util.concurrent.ConcurrentLinkedQueue.addAll(ConcurrentLinkedQueue.java:530)
      	at org.xnio.ByteBufferSlicePool.clean(ByteBufferSlicePool.java:214)
      	at org.wildfly.extension.io.BufferPoolService.stop(BufferPoolService.java:62)
      	at org.jboss.msc.service.ServiceControllerImpl$StopTask.stopService(ServiceControllerImpl.java:1795)
      	at org.jboss.msc.service.ServiceControllerImpl$StopTask.execute(ServiceControllerImpl.java:1764)
      	at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
      	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
      	at java.lang.Thread.run(Thread.java:748)
      

      This issue happens since EAP 7.2.4 that incorporates JBEAP-17380 / (XNIO-345 / XNIO-346).

      This NPE itself is harmless and ignorable as direct buffers is disabled. However, it's better to fix this by adding a null check for "directBuffers". For example:

      diff --git a/api/src/main/java/org/xnio/ByteBufferSlicePool.java b/api/src/main/java/org/xnio/ByteBufferSlicePool.java
      index cae23c5..f30125e 100644
      --- a/api/src/main/java/org/xnio/ByteBufferSlicePool.java
      +++ b/api/src/main/java/org/xnio/ByteBufferSlicePool.java
      @@ -206,8 +206,11 @@ public final class ByteBufferSlicePool implements Pool<ByteBuffer> {
               if(!sliceQueue.isEmpty()) {
                   sliceQueue.clear();
               }
      -        // pass everything that is directly allocated to free direct buffers
      -        FREE_DIRECT_BUFFERS.addAll(directBuffers);
      +        // only true if using direct allocation
      +        if (directBuffers != null) {
      +            // pass everything that is directly allocated to free direct buffers
      +            FREE_DIRECT_BUFFERS.addAll(directBuffers);
      +        }
           }
       
           /**
      

      Attachments

        Issue Links

          Activity

            People

              rhn-support-mmiura Masafumi Miura
              rhn-support-mmiura Masafumi Miura
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: