Skip to content

Conversation

TingDaoK
Copy link
Contributor

Issue #, if available:

Description of changes:

  • if AWS_ERROR_HTTP_STREAM_HAS_COMPLETED reported, the error SHOULD not be related to the data write.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link

codecov-commenter commented Apr 11, 2025

Codecov Report

Attention: Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.48%. Comparing base (c997d8f) to head (5c6bec2).

Files with missing lines Patch % Lines
source/h2_frames.c 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #512      +/-   ##
==========================================
- Coverage   79.49%   79.48%   -0.01%     
==========================================
  Files          27       27              
  Lines       11684    11686       +2     
==========================================
+ Hits         9288     9289       +1     
- Misses       2396     2397       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@@ -223,7 +223,8 @@ int aws_h2_encode_data_frame(
size_t *connection_window_size_peer,
struct aws_byte_buf *output,
bool *body_complete,
bool *body_stalled);
bool *body_stalled,
bool *body_error);
Copy link
Contributor

Choose a reason for hiding this comment

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

utterly trivial: error isn't this most boolean-ish word

Suggested change
bool *body_error);
bool *body_failed);

Comment on lines 1349 to 1350
pending_write->error_code = AWS_ERROR_HTTP_MANUAL_WRITE_HAS_COMPLETED;
s_stream_data_write_destroy(stream, pending_write);
Copy link
Contributor

Choose a reason for hiding this comment

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

debatable/trivial: it seems a bit fragile that we be so careful about setting write->error_code before calling destroy(). It would be easy to miss a spot, and have a write complete with error_code 0 in some weird error situation.

Maybe go back to passing error_code to the destroy() function.
If a data_frame fails due a write, then destroy the write immediately, instead of leaving it in a list to get cleaned up later. That's how it works with HTTP/1 chunked encoding (see code). If failure was caused by the chunk, the chunk is immediately destroyed with that error code. Then connection shutdown continues...

Comment on lines 818 to 820
if (input_stream_error) {
/* If the error comes from the input stream, propagate it to the current_write */
current_write->error_code = aws_last_error();
Copy link
Contributor

Choose a reason for hiding this comment

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

(continuing previous comment)
so like here, we could pop the current_write out of its list and destroy it

Copy link
Contributor

@graebm graebm left a comment

Choose a reason for hiding this comment

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

I pushed my own code, but you started this PR so can't Accept. Merge if you like, change if you don't

@TingDaoK TingDaoK merged commit 6586c80 into main Apr 14, 2025
42 checks passed
@TingDaoK TingDaoK deleted the better-error-report-take-2 branch April 14, 2025 15:53
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