denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
93.38k stars 5.18k forks source link

'connection closed before message completed' with fetch #17754

Open jgibo opened 1 year ago

jgibo commented 1 year ago

deno 1.30.3 (release, aarch64-apple-darwin) (Apple M1) v8 10.9.194.5 typescript 4.9.4

'connection closed before message completed' when using fetch, occurring sometimes locally (seemingly random), but always occurring on the 4th outbound fetch request in a Google Cloud Run First Generation service (reoccurs on 4th request when calling the endpoint again). Interestingly, in Cloud Run Second Generation the issue does not occur.

GCP article about First Generation vs Second Generation. Maybe most interestingly, 'The second generation execution environment provides full Linux compatibility rather than system call emulation.'

Will try create a reproduction sometime this week.

aapoalas commented 1 year ago

A reproduction, even if it only occurs sporadically (seemingly randomly), will probably be needed.

tjconcept commented 1 year ago

I'm seeing this too. I ported a small script from Node.js to Deno which invokes fetch on an interval. It seems the duration of the interval plays a part. 10 seconds is almost sure to hit it, but with 5 seconds it doesn't come up. I've tried isolating it to create a reproduction, but the problem disappears when I modify sufficiently.

The target server has no sign (Nginx logs) of the request.