Skip to content

Comments

fix: resolve context canceled when reading HTTP response body (#3141)#3160

Open
hadzija7 wants to merge 1 commit intosuperplanehq:mainfrom
hadzija7:main
Open

fix: resolve context canceled when reading HTTP response body (#3141)#3160
hadzija7 wants to merge 1 commit intosuperplanehq:mainfrom
hadzija7:main

Conversation

@hadzija7
Copy link

What changed

Fixes the HTTP component failing with "failed to read response body: context canceled" despite successful requests. The component now completes reading the response body before the request context is canceled.

Why

When the HTTP component made requests to endpoints that return large or slowly-streaming responses, the request context was canceled via defer cancel() immediately when executeRequest returned—before processResponse could read the body. The 30s client timeout could also fire during body read. This caused the component to fail with context canceled even when the server returned 200 OK.

Closes #3141

How

  • Deferred context cancel: executeRequest now returns the cancel function to the caller instead of calling defer cancel() internally. The caller defers cancel() only after the response is fully processed.
  • Error path cleanup: On error (URL parse, request creation, or Do failure), the context is canceled before returning to avoid leaking the context.
  • Retry path cleanup: When scheduling a retry after a non-success status, the response body is closed before returning to avoid leaking connections.

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.

HTTP component: context canceled when reading response body

1 participant