@@ -262,15 +262,31 @@ new S3Client({
262
262
});
263
263
```
264
264
265
- A note on ** socket exhaustion** : if you encounter an error that indicates
265
+ A note on ** socket exhaustion** :
266
+
267
+ The SDK may emit the following warning when detecting socket exhaustion:
268
+
269
+ ```
270
+ @smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.
271
+ ```
272
+
273
+ Socket exhaustion detection is not an exact determination.
274
+ We only warn on this when there is a high count of ` requestsEnqueued ` ,
275
+ because running at socket capacity may be intentional and normal in your application.
276
+
277
+ If you encounter the above warning or an error that indicates
266
278
you have run out of sockets due to a high volume of requests flowing through
267
279
your SDK Client, there are two things to check:
268
280
269
281
1 . Ensure that the number value of ` maxSockets ` is high enough for your
270
282
throughput needs.
271
283
2 . Because ` keepAlive ` is defaulted to ` true ` , if you acquire a streaming response,
272
- such as ` S3::getObject ` 's ` Body ` field. You must read the stream to completion
273
- in order for the socket to close naturally.
284
+ such as ` S3::getObject ` 's ` Body ` field, you must read the stream to completion
285
+ in order for the socket to close naturally. You can also destroy the stream in Node.js with
286
+ e.g. ` (await s3.getObject(...)).Body.destroy() ` if it is a Node.js Readable stream.
287
+ Specifically in the case of S3, if you don't need the object body,
288
+ consider whether the object metadata can be retrieved with another operation such as
289
+ ` HeadObject ` or ` GetObjectMetadata ` .
274
290
275
291
``` ts
276
292
// Example: reading a stream to allow socket closure.
0 commit comments