Skip to content

hcm: Handle stream destroy during encodeData due to sendLocalReply#15075

Merged
mattklein123 merged 7 commits intoenvoyproxy:mainfrom
nareddyt:hcm-encode-data-reply
Mar 17, 2021
Merged

hcm: Handle stream destroy during encodeData due to sendLocalReply#15075
mattklein123 merged 7 commits intoenvoyproxy:mainfrom
nareddyt:hcm-encode-data-reply

Conversation

@nareddyt
Copy link
Copy Markdown
Contributor

@nareddyt nareddyt commented Feb 17, 2021

Commit Message:
hcm: Handle stream destroy during encodeData due to sendLocalReply

Additional Description:
Fixes an issue that surfaced when adding buffer limits to the grpc_json_transcoder filter in #14906.

When sendLocalReply occurs during encodeData, the stream is reset because headers were already sent.
Short-circuit the logic as the data buffer does not need to be handled - the sendLocalReply should be shipped back right away.

Risk Level:
Medium. Changes existing logic in HCM, but has integration tests.

Testing:
Integration test here and in grpc_json_transcoder filter (#14906).

Docs Changes:
None

Release Notes:
None

Platform Specific Features:
None

Signed-off-by: Teju Nareddy nareddyt@google.com

Signed-off-by: Teju Nareddy <nareddyt@google.com>
@nareddyt
Copy link
Copy Markdown
Contributor Author

Hi @alyssawilk and @snowp, can you double check the logic in the PR description makes sense? I only have a rough understanding of the HCM control flow.

@alyssawilk introduced the assertion in #7720. @snowp fixed a similar bug (sendLocalReply interactions with HCM) in #13256.

@snowp snowp self-assigned this Feb 17, 2021
@nareddyt nareddyt changed the title hcm: Weaken assertion for connection reset during encodeData hcm: Weaken assertion for stream reset during encodeData Feb 27, 2021
Signed-off-by: Teju Nareddy <nareddyt@google.com>
@alyssawilk
Copy link
Copy Markdown
Contributor

Sorry was out Thursday/Friday. I've commented in the original PR but I think ideally we should not hit this function at all in the local-reply-sent case so let's hash out a plan there and revisit this if needed, sound good?

@nareddyt
Copy link
Copy Markdown
Contributor Author

nareddyt commented Mar 1, 2021

No problem! I'll close this PR in favor of the discussion in #14906

@nareddyt nareddyt closed this Mar 1, 2021
# Conflicts:
#	source/common/http/filter_manager.h

Signed-off-by: Teju Nareddy <nareddyt@google.com>
@nareddyt nareddyt changed the title hcm: Weaken assertion for stream reset during encodeData hcm: Handle stream destroy during encodeData due to sendLocalReply Mar 16, 2021
@nareddyt nareddyt reopened this Mar 16, 2021
Signed-off-by: Teju Nareddy <nareddyt@google.com>
@nareddyt
Copy link
Copy Markdown
Contributor Author

@mattklein123 here is the change from #14906 split out, with a dedicated core test.

@mattklein123
Copy link
Copy Markdown
Member

Great, thanks.

@mattklein123 mattklein123 self-assigned this Mar 16, 2021
alyssawilk
alyssawilk previously approved these changes Mar 16, 2021
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks LGTM with small comment.

/wait

Signed-off-by: Teju Nareddy <nareddyt@google.com>
Signed-off-by: Teju Nareddy <nareddyt@google.com>
Signed-off-by: Teju Nareddy <nareddyt@google.com>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mattklein123 mattklein123 merged commit 7ecc306 into envoyproxy:main Mar 17, 2021
@nareddyt nareddyt deleted the hcm-encode-data-reply branch March 17, 2021 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants