Skip to content

Should file system buffer filer call injectDecodedDataToFilterChain with appropriate end_stream flag? #43170

Closed

Description

@yanjunxiang-google

Title: File system buffer filer should call injectDecodedDataToFilterChain with appropriate end_stream flag

Description:

Currently it is calling injectDecodedDataToFilterChain() and injectencodedDataToFilterChain() with hard coded "false", regardless whether the data is the last chunk, or whether there will be trailers behind:

request_callbacks_->injectDecodedDataToFilterChain(*out, false);

response_callbacks_->injectEncodedDataToFilterChain(*out, false);

Activity

  1. added
    triage
    on Jan 26, 2026
  2. changed the title [-]Should file system buffer filer should call injectDecodedDataToFilterChain with appropriate end_stream flag?[/-] [+]Should file system buffer filer call injectDecodedDataToFilterChain with appropriate end_stream flag?[/+] on Jan 26, 2026
  3. yanjunxiang-google commented on Jan 26, 2026

    @yanjunxiang-google
    ContributorAuthor
  4. added
    question
    and removed
    triage
    on Jan 26, 2026
  5. ravenblackx commented on Jan 27, 2026

    @ravenblackx
    Contributor

    My understanding is that the subsequent continueDecoding resolves this correctly because the buffer is empty at that point (and leads to correctly handling trailers automatically - if there's some shared-buffer-related issue that can be provoked by the current implementation then that issue would still be problematic in the case where trailers are present, where the end_stream argument must still be false.)

    I would not endorse changing this unless it can be demonstrated that the current implementation behaves incorrectly under some circumstances and that changing it would fix it for both of those situations.

    (My guess is that it does behave incorrectly under some rare configuration circumstances, but that those circumstances are inherently broken because of the shared filter chain buffer; the correct fix for that is to fix that much older and broader mistake that impacts multiple filters, which would also make this implementation behave correctly, under the problematic "multiple filters in a filter chain have internal buffers" case, for the trailers case.)

  6. ravenblackx commented on Jan 27, 2026

    @ravenblackx
    Contributor

    Or: If it was behaving incorrectly under normal circumstances then I would expect the integration tests to be failing. If there's a reason to change it, I would expect an integration test demonstrating the "wrong" behavior to be a start point.

  7. ravenblackx commented on Jan 27, 2026

    @ravenblackx
    Contributor

    Ah, I see, this is not actually "should it be changed now" but rather "we want to change the API of injectDecodedDataToFilterChain to be more strict", per #43042 (comment)

    If it's for that purpose then I would approve a change to this filter to facilitate that, though I can pretty much guarantee it will be a pain!

  8. yanjunxiang-google commented on Jan 27, 2026

    @yanjunxiang-google
    ContributorAuthor

    Yes, I read through file_system_buffer filter code. To make injectDecodedDataToFilterChain(, end_of_stream) always correctly set end_of_stream is not simple. It needs to consider whether this is the last data chunk, also whether there is trailers behind.

    On the other hand, I don't any issues with the current file_system_buffer filter code. As you mentioned above, the continueDecoding() call right after injectDecodedDataToFilterChain()

    request_callbacks_->continueDecoding();
    , probably avoided the issues we observed in ext_proc.

    With all of that, let's leave it as it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/file_system_bufferquestion

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions