Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-2389

DefaultByteBufferPool leaks buffers for released threads

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Critical Critical
    • 2.3.14.Final, 2.2.33.Final
    • 2.2.30.Final, 2.3.11.Final
    • Core
    • None
    • Hide

      See README in undertow2389reproducer.zip

      Show
      See README in undertow2389reproducer.zip
    • Workaround Exists
    • Hide

      Configure the task thread pool with core equal to max to avoid idle thread releases:

      <subsystem xmlns="urn:jboss:domain:io:3.0">
              <worker name="default" task-core-threads="192" task-max-threads="192"/>
              <buffer-pool name="default"/>
          </subsystem>
      
      Show
      Configure the task thread pool with core equal to max to avoid idle thread releases: <subsystem xmlns= "urn:jboss:domain:io:3.0" > <worker name= " default " task-core-threads= "192" task-max-threads= "192" /> <buffer-pool name= " default " /> </subsystem>
    • Low

      Due to UNDERTOW-2309, DefaultByteBufferPool can now leak buffers over time as threads are released (such as idle threads above task-core-threads being released and recreated with load oscillations over time).

      Before UNDERTOW-2309, the ThreadLocalData buffers were stored directly on the Thread via the standard java ThreadLocals so if the Thread died, the ThreadLocalData was inherently released from the Thread's own local map. But now if a thread dies, it is not ever released from the io.undertow.server.DefaultByteBufferPool$ThreadLocalCache's localsByThread map. So a heap dump shows the entries piling up here:

      Class Name                                                                                   | Ref. Objects | Shallow Heap | Ref. Shallow Heap | Retained Heap
      ---------------------------------------------------------------------------------------------------------------------------------------------------------------
      [56] class io.undertow.protocols.ssl.UndertowXnioSsl @ 0xaf1b2a10                            |       71,676 |            8 |         1,720,224 |            32
      '- DEFAULT_BUFFER_POOL io.undertow.server.DefaultByteBufferPool @ 0xaf1b2a80                 |       71,676 |           64 |         1,720,224 |    20,792,448
         '- threadLocalCache io.undertow.server.DefaultByteBufferPool$ThreadLocalCache @ 0xaf1b2ac0|       71,676 |           16 |         1,720,224 |    18,071,056
            '- localsByThread java.util.HashMap @ 0xaf1b2ad0                                       |       71,676 |           48 |         1,720,224 |    18,071,040
               '- table java.util.HashMap$Node[131072] @ 0xb3c67d20                                |       71,676 |      524,304 |         1,720,224 |    18,070,992
                  |- [108494] java.util.HashMap$Node @ 0xb1610fb0                                  |            6 |           32 |               144 |         1,488
                  |  |- next java.util.HashMap$Node @ 0xb1def998                                   |            5 |           32 |               120 |         1,240
                  |  |- value io.undertow.server.DefaultByteBufferPool$ThreadLocalData @ 0xb15d5e98|            1 |           24 |                24 |           128
      ---------------------------------------------------------------------------------------------------------------------------------------------------------------
      

            flaviarnn Flavia Rainone
            rhn-support-aogburn Aaron Ogburn
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: