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 — DefaultHttp2RemoteFlowController: writeAllocatedBytes & Endless loop · Issue #11959 · netty/netty

DefaultHttp2RemoteFlowController: writeAllocatedBytes & Endless loop #11959

New issue
Copy link
New issue
Copy link
Closed
#14220
Closed
DefaultHttp2RemoteFlowController: writeAllocatedBytes & Endless loop#11959
#14220
Copy link
Milestone
4.1.113.Final

Description

@lin233
lin233
opened on Dec 28, 2021
Issue body actions

There is a small probability I can't shut down a stream normally.
and I found I'm stuck in an endless loop at these code:

            while (!cancelled && (frame = peek()) != null) {
                int maxBytes = min(allocated, writableWindow());
                if (maxBytes <= 0 && frame.size() > 0) {
                    // The frame still has data, but the amount of allocated bytes has been exhausted.
                    // Don't write needless empty frames.
                    break;
                }
                writeOccurred = true;
                int initialFrameSize = frame.size();
                try {
                    frame.write(ctx, max(0, maxBytes));
                    if (frame.size() == 0) {
                        // This frame has been fully written, remove this frame and notify it.
                        // Since we remove this frame first, we're guaranteed that its error
                        // method will not be called when we call cancel.
                        pendingWriteQueue.remove();
                        frame.writeComplete();
                    }
                } finally {
                    // Decrement allocated by how much was actually written.
                    allocated -= initialFrameSize - frame.size();
                }
            }

my pendingWriteQueue had 2 frame, and the first one cannot always be removed, the second is endStream.

Netty version

4.1.63.Final

Activity

Next
  1. normanmaurer commented on Dec 28, 2021

    @normanmaurer
    normanmaurer
    on Dec 28, 2021
    Member
    More actions

    @lin233 can you provide some more details about what maxBytes is and frame.size() ?

  2. lin233 commented on Dec 28, 2021

    @lin233
    lin233
    on Dec 28, 2021
    Author
    More actions

    maxBytes = 19, frame.size() = 19 ,allocated = 19

    image

    image

    other details:
    image

  3. lin233 commented on Dec 28, 2021

    @lin233
    lin233
    on Dec 28, 2021
    Author
    More actions

    @normanmaurer Is there anything else i can provide? Thank you for your attention.

  4. RK23HUNTER commented on Dec 29, 2021

    @RK23HUNTER
    RK23HUNTER
    on Dec 29, 2021
    More actions

    whirt one progarm and print

  5. chrisvest commented on Jan 5, 2022

    @chrisvest
    chrisvest
    on Jan 5, 2022
    Member
    More actions

    Is the frame.size() not changed by the write() call for some reason?

  6. lin233 commented on Jan 6, 2022

    @lin233
    lin233
    on Jan 6, 2022
    Author
    More actions

    yes, the frame.size() not changed.

  7. normanmaurer commented on Jan 6, 2022

    @normanmaurer
    normanmaurer
    on Jan 6, 2022
    Member
    More actions

    @lin233 is there a way for us to reproduce easily ?

  8. lin233 commented on Jan 7, 2022

    @lin233
    lin233
    on Jan 7, 2022
    Author
    More actions

    The time It happened was always when I disconnect grpc connections, and the stream state is "HALF_CLOSED_REMOTE". Maybe connect and disconnect frequent grpc with high concurrency can reproduce easily. and my situation is two-way flow.

  9. lin233 commented on Jan 7, 2022

    @lin233
    lin233
    on Jan 7, 2022
    Author
    More actions

    The problem will put the service into suspended animation. If it is difficult to find out why the frame.size() cannot be changed, can we make it not stuck in an infinite loop when frame.size() cannot be changed for some reason?

    Thank you for your attention.

  10. normanmaurer commented on Jan 7, 2022

    @normanmaurer
    normanmaurer
    on Jan 7, 2022
    Member
    More actions

    @lin233 btw 4.1.63.Final is really old. Can you upgrade to latest netty version and see if this still happens ?

  11. lin233 commented on Jan 10, 2022

    @lin233
    lin233
    on Jan 10, 2022
    Author
    More actions

    @normanmaurer OK,I will try.

    Thank you for your attention.

  12. normanmaurer commented on Jan 11, 2022

    @normanmaurer
    normanmaurer
    on Jan 11, 2022
    Member
    More actions

    @lin233 please report back

  13. normanmaurer
    added this to the 4.1.73.Final milestone on Jan 11, 2022
  14. lin233 commented on Jan 11, 2022

    @lin233
    lin233
    on Jan 11, 2022
    Author
    More actions

    @normanmaurer I upgrade to 4.1.72.Final and this still happened.

  15. normanmaurer commented on Jan 11, 2022

    @normanmaurer
    normanmaurer
    on Jan 11, 2022
    Member
    More actions

    @lin233 can you provide me a program that I can run here and reproduce ?

  16. 32 remaining items

  17. normanmaurer
    added a commit that references this issue on Aug 10, 2024

    Ensure AbstractCoalescingBufferQueue does not end up in inconsistent …

    8f191ad
  18. normanmaurer commented on Aug 10, 2024

    @normanmaurer
    normanmaurer
    on Aug 10, 2024
    Member
    More actions

    @koo-taejin thanks a lot for all the details... it really helped me to understand what is wrong here. Fix should be this #14220

    Reacted by koo-taejin
  19. koo-taejin commented on Aug 12, 2024

    @koo-taejin
    koo-taejin
    on Aug 12, 2024
    More actions

    @normanmaurer

    I have a question.

    I thought the code I mentioned would not throw an exception and would continue to loop infinitely.

    // io.netty.channel.AbstractCoalescingBufferQueue#remove
    if (bufAndListenerPairs.isEmpty()) {
                assert readableBytes == 0;
                return removeEmptyValue();
    }
    

    However, the fix seems to fix the problem in the case where an exception is thrown.

    I may have misunderstood because I do not have enough knowledge about netty.
    Thank you for your quick response to this issue.

  20. normanmaurer
    closed this as completedin #14220on Aug 13, 2024
  21. normanmaurer
    closed this as completedin eaf788eon Aug 13, 2024
  22. normanmaurer
    added 2 commits that reference this issue on Aug 13, 2024

    Ensure AbstractCoalescingBufferQueue does not end up in inconsistent … (

    0f2beb2

    Ensure AbstractCoalescingBufferQueue does not end up in inconsistent … (

    7f2b3d0
  23. normanmaurer commented on Aug 13, 2024

    @normanmaurer
    normanmaurer
    on Aug 13, 2024
    Member
    More actions

    @koo-taejin I think what happened is that it did throw an IllegalReferenceCountException at some point and so things did end up in an inconsistent state which never could break recovered. This is not possible anymore with this change

  24. koo-taejin commented on Aug 13, 2024

    @koo-taejin
    koo-taejin
    on Aug 13, 2024
    More actions

    @normanmaurer
    Thanks for letting me know. :)

  25. luozongle01
    added a commit that references this issue on Aug 13, 2024

    Ensure AbstractCoalescingBufferQueue does not end up in inconsistent … (

    eaf788e
  26. gavinbunney
    added a commit that references this issue on Jun 15, 2026

    Fix potential `CoalescingBufferQueue` desync by tracking each body re…

    7aaaf96
  27. normanmaurer
    added 2 commits that reference this issue on Jun 25, 2026

    Reconcile `AbstractCoalescingBufferQueue` readableBytes when it drain…

    a5d4f28

    Auto-port 4.1: Reconcile `AbstractCoalescingBufferQueue` readableByte…

    26bb273
  28. chrisvest
    added a commit that references this issue on Jun 30, 2026

    Reconcile `AbstractCoalescingBufferQueue` readableBytes when it drain… (

    96c78c9
  29. lltopk
    added a commit that references this issue on Oct 24, 2026

    Auto-port 4.1: Reconcile `AbstractCoalescingBufferQueue` readableByte…

    24e57cf
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.113.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.