Skip to content

HybridJacksonPool can lose pooled recyclers due to stack node publication race #6111

@dreamlike-ocean

Description

@dreamlike-ocean

Version

every version

Context

HybridJacksonPool.StripedLockFreePool#releasePooled publishes a new stack head with CAS before initializing the node's next pointer.

current:

if (topStacks.compareAndSet(slot, next, newHead)) {
  newHead.next = next;
  return;
}

A concurrent acquirePooled can observe newHead immediately after the CAS, before newHead.next is assigned. In that window it may pop newHead and replace the stack head with null, detaching the previous stack.

I will submit a pr to fix it

Steps to reproduce

No response

Do you have a reproducer?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions