[OpenNMS/opennms] 393e9b: NMS-20271: Fix the two stalls in the off-heap disp...

mershad-manesh via opennms-cvs <[email protected]>
Newsgroups gmane.network.opennms.cvs
Message-ID <OpenNMS/opennms/push/refs/heads/mem/NMS-20271/[email protected]>
  Branch: refs/heads/mem/NMS-20271
  Home:   https://github.com/OpenNMS/opennms
  Commit: 393e9b684bd1735473c5047869f869b753c1f5cd
      https://github.com/OpenNMS/opennms/commit/393e9b684bd1735473c5047869f869b753c1f5cd
  Author: Marshall Massengill <[email protected]>
  Date:   2026-08-28 (Fri, 28 Aug 2026)

  Changed paths:
    M core/ipc/sink/off-heap/src/main/java/org/opennms/core/ipc/sink/offheap/DataBlocksOffHeapQueue.java
    M core/ipc/sink/off-heap/src/main/java/org/opennms/core/ipc/sink/offheap/OffHeapDataBlock.java
    A core/ipc/sink/off-heap/src/test/java/org/opennms/core/ipc/sink/offheap/DataBlocksOffHeapQueueDeadlockTest.java

  Log Message:
  -----------
  NMS-20271: Fix the two stalls in the off-heap dispatch queue

A consumer crossing the memory to off-heap transition wedges the whole
queue, and switching the DataBlock dequeues to poll() does not reach it.

enableQueue() acquired diskLock and then waited on the flush future,
while the flush task acquires that same diskLock, so neither side could
proceed. The consumer sat in Object.wait holding diskLock, the block
monitor, headLock and tailLock, which left every producer parked on
tailLock. ThreadMXBean reports no deadlock because one side of the cycle
is a timed wait rather than a lock. Waiting on the future before taking
diskLock breaks it, and the caller-side lock handshake in flushToDisk()
is no longer needed. The restructured method also stops unlocking
diskLock it never acquired when the wait is interrupted.

readData() only evicted an empty head after a successful dequeue, so a
block drained while it was still the tail stayed head once producers
appended behind it. Consumers then spun RUNNABLE on it holding headLock.
Evicting on every non-tail pass clears it.

Measured over 20 runs of 8 producers and 8 consumers at 16k messages:
the queue stalls 16/20 before this change and 19/20 with poll() alone,
0/20 with both fixes. Each fix alone leaves the other mode: the lock
ordering fix alone stalls 2/20 on the spin, the eviction fix alone
stalls 13/20 on the deadlock.

Both stalls are silent, so the new test asserts on forward progress
rather than completion. It catches the unfixed code 6/10 and passes
40/40 against the fix in under a second.


  Commit: e8519ddfc2203f622995cedffc427f5788bc1d18
      https://github.com/OpenNMS/opennms/commit/e8519ddfc2203f622995cedffc427f5788bc1d18
  Author: Morteza E <[email protected]>
  Date:   2026-08-28 (Fri, 28 Aug 2026)

  Changed paths:
    A core/ipc/sink/off-heap/src/test/java/org/opennms/core/ipc/sink/offheap/DataBlocksOffHeapQueueBackpressureDeadlockTest.java

  Log Message:
  -----------
  add regression test for the shared backpressure lock fix


Compare: https://github.com/OpenNMS/opennms/compare/05bf74c08d8c...e8519ddfc220

To unsubscribe from these emails, change your notification settings at https://github.com/OpenNMS/opennms/settings/notifications


_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/wiki/index.php?page=MailingListFaq
opennms-cvs mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.