-
Notifications
You must be signed in to change notification settings - Fork 760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 BUG: POST requests often fail with wrangler dev #5095
Comments
👀 I went to repro this using I then took to putting Yup, that's the reason
Given this, I very much suspect that the connection timeout issue being seen might be due to something in wrangler being overwhelmed as it still has previous connections being held open while the loop has moved onto the next Running the worker with
Running the |
Hi @Cherry! Thanks for putting this together – it really helped us hone in on the issue and I can confirm we can reliably reproduce the bug. We believe we're seeing something similar to either cloudflare/workerd#960 or cloudflare/workerd#1376 or a mixture of them both. We will open another issue in the workerd repo if needs be. We have a workaround confirmed to fix the issue which we will be able to hotfix into wrangler. The workaround essentially boils down to ensuring the request body is drained in the UserWorker. We need some time to confirm the workaround won't cause any other issues (with body reuse, etc) before releaseing. In the meantime, to unblock you and your team, please ensure your Worker drains the request body stream with We will aim to get the hotfix released today or in tomorrow's regular release. |
👀 If consuming the body is the issue here, then the connection remaining opening appears to be a different issue? It happens on both POST w/ body and GET requests.
|
Hi @MattIPv4 – that is indeed odd but, as you said, is likely unrelated. I have created this issue in workerd to follow up. If you have anymore info, please post there. Thanks for highlighting! |
potential workaround for #5095
potential workaround for #5095
… workerd (#5106) * ensure request.body is drained potential workaround for #5095 * regression test * fixup! regression test * fixup! regression test Use larger body and ensure request read before response sent * allow request draining to be disabled and add changeset * remove unnecessary export * fixup! ensure request.body is drained --------- Co-authored-by: Peter Bacon Darwin <[email protected]> Co-authored-by: bcoll <[email protected]>
Which Cloudflare product(s) does this pertain to?
Wrangler core
What version(s) of the tool(s) are you using?
3.29.0
What version of Node are you using?
20.11.1
What operating system and version are you using?
Windows 11
Describe the Bug
Observed behavior
POST
requests with data fail ~50% of the time, with a genericError: Network connection lost.
. I've had multiple users in Discord reproduce this bug.Expected behavior
I would expect all requests to suceed.
Steps to reproduce
worker.js
npx wrangler dev worker.js
Windows:
curl.exe http://127.0.0.1:8787 -d '{"foo": "bar"}'
Mac:
curl http://127.0.0.1:8787 -d '{"foo": "bar"}'
Every other request (in my environment) will fail. I've had others reproduce this with the same failure rate on Windows 11, and a much lower rate (only about 2 or 3 every 20 reqs on MacOS).
cc @RamIdeas
This is something I've been observing with some contractors recently, working with HTTP clients within games. I've had a really hard time getting to the bottom of it, but with this issue, appear to have a reliably reproduction now.
Note: this is a major regression. If I use
npx [email protected] dev worker.js
, I can no longer reproduce the issue. Any wrangler version >= 3.19.0 and this breaks.Likely related:
The text was updated successfully, but these errors were encountered: