-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
This happens to me in Cloudflare Workers
A stalled HTTP response was canceled to prevent deadlock. This can happen when a Worker calls fetch() or cache.match() several times without reading the bodies of the returned Response objects. There is a limit on the number of concurrent HTTP requests that can be in-flight at one time. Normally, additional requests made beyond that limit are delayed until previous responses complete. However, because the Worker did not read the responses, they would never complete. Therefore, to prevent deadlock, the oldest response was canceled. To avoid this warning, make sure to either read the body of every HTTP Response or call response.body.cancel() to cancel a response that you don't plan to read from.
Which looks like its cause by the worker hitting a limit of max inflight requests with pending body response streams opens.
Probably not a huge deal with other runtimes, but reading the body before disptaching other requests seem like an overall improvement so I made the issue here
To Reproduce
Steps to reproduce the behavior:
- Use this sdk in cloudflare workers to connect to a MCP server behind oauth.
- Dont give the oauth provider valid access tokens so it gets a 401 and tries to refresh tokens right away
- Observe all the fetch'es to oauth metadata and the authorization server endpoints and the error message above
Expected behavior
Automatic oauth flow should not result in that error message. Response body's should be (1) always consumed, and (2) read before deploying a new fetch, if possible
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working