GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Sentinel object `Magazine.MAGAZINE_FREED` is possible be replaced without be restored back · Issue #14498 · netty/netty

Sentinel object Magazine.MAGAZINE_FREED is possible be replaced without be restored back #14498

New issue
Copy link
New issue
Copy link
Closed
#14502
Closed
Sentinel object Magazine.MAGAZINE_FREED is possible be replaced without be restored back#14498
#14502
Copy link
Milestone
4.1.116.Final

Description

@laosijikaichele
laosijikaichele
opened on Nov 25, 2024
Issue body actions

Expected behavior

If I understood it right, the sentinel object Magazine.MAGAZINE_FREED should not be replaced without being restored back.

Actual behavior

netty/buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java

Lines 665 to 684 in afa465a

private void transferChunk(Chunk current) {
if (NEXT_IN_LINE.compareAndSet(this, null, current)
|| parent.offerToQueue(current)) {
return;
}
Chunk nextChunk = NEXT_IN_LINE.get(this);
if (nextChunk != null && current.remainingCapacity() > nextChunk.remainingCapacity()) {
if (NEXT_IN_LINE.compareAndSet(this, nextChunk, current)) {
if (nextChunk != MAGAZINE_FREED) {
nextChunk.release();
}
return;
}
}
// Next-in-line is occupied AND the central queue is full.
// Rare that we should get here, but we'll only do one allocation out of this chunk, then.
current.release();
}

The line:671 Chunk nextChunk = NEXT_IN_LINE.get(this); if nextChunk get value MAGAZINE_FREED, which is possible when magazines table is doing resizing, then the line:673 NEXT_IN_LINE.compareAndSet(this, nextChunk, current) will replace the MAGAZINE_FREED object by current, and without restored the MAGAZINE_FREED back.

Possible solution:

Modified line:672 to:

if (nextChunk != null && nextChunk != MAGAZINE_FREED 
&& current.remainingCapacity() > nextChunk.remainingCapacity()) {
...
}

Netty version

4.1.115.Final

Activity

  1. normanmaurer commented on Nov 25, 2024

    @normanmaurer
    normanmaurer
    on Nov 25, 2024
    Member
    More actions

    @laosijikaichele sounds about right ... please do a PR

  2. normanmaurer
    added this to the 4.1.116.Final milestone on Nov 25, 2024
  3. laosijikaichele commented on Nov 25, 2024

    @laosijikaichele
    laosijikaichele
    on Nov 25, 2024
    ContributorAuthor
    More actions

    OK, will do it soon.

  4. normanmaurer
    closed this as completedin #14502on Nov 26, 2024
  5. normanmaurer
    added 3 commits that reference this issue on Nov 26, 2024

    Make sure the sentinel `Magazine.MAGAZINE_FREED` not be replaced (#14502

    This issue will close once commit 3d2b816 is merged into the '4.2' branch.
    3d2b816

    Make sure the sentinel `Magazine.MAGAZINE_FREED` not be replaced (#14502

    This issue will close once commit 2e00270 is merged into the '4.2' branch.
    2e00270

    Make sure the sentinel `Magazine.MAGAZINE_FREED` not be replaced (#14… (

    This issue will close once commit 348ed8d is merged into the '4.2' branch.
    348ed8d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      • 4.1.116.Final

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.