This reproduce is a result of digging further into the issue reported in
aws/aws-sdk-js-v3#6426. It is somewhat similar to
https://github.com/martinslota/aws-sdk-lib-storage-race but it does not use any
AWS-specific libraries and instead uses the built-in Node.js https module
directly.
Overall, it shows that HTTPS client requests tend to hang when all of the following occurs at the same time:
- The client specifies the
Expect: 100-continueheader to the server. - The client specifies that the payload is empty using the
Content-Length: 0header to the server. - The client delays calling
req.end()a little bit after creating the request. - The client calls
req.end()with an empty buffer as the first argument.
These conditions are not merely theoretical: The requests sent by the AWS SDK
(e.g. PutObject requests to S3) are sometimes exactly like that.
The code in index.js starts a simple HTTPS server and then hammers it, one request at a time, with requests that satisfy the above conditions.
- Clone this repository
- Switch to Node.js version 22.20.0 using
fnm use - Install dependencies using
npm ci - Run
npm start
After some time, the script tends to lock up and fail while waiting for a response, producing this kind of output.