Skip to content

Commit 6c297b7

Browse files
authored
docs: remarks on socket exhaustion warning (#6692)
* docs: remarks on socket exhaustion warning * docs: update for S3 streaming bodies * docs: grammar
1 parent 53b12f4 commit 6c297b7

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

supplemental-docs/CLIENTS.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,31 @@ new S3Client({
262262
});
263263
```
264264

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
266278
you have run out of sockets due to a high volume of requests flowing through
267279
your SDK Client, there are two things to check:
268280

269281
1. Ensure that the number value of `maxSockets` is high enough for your
270282
throughput needs.
271283
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`.
274290

275291
```ts
276292
// Example: reading a stream to allow socket closure.

0 commit comments

Comments
 (0)