Skip to content

Commit 22c7d7a

Browse files
committed
Better conventions around timeouts and handling
1 parent 880673a commit 22c7d7a

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

docs/specification/draft/basic/lifecycle.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,17 +190,30 @@ exiting.
190190
For HTTP [transports]({{< ref "/specification/draft/basic/transports" >}}), shutdown is
191191
indicated by closing the associated HTTP connection(s).
192192

193+
## Timeouts
194+
195+
Implementations **SHOULD** establish timeouts for all sent requests, to prevent hung
196+
connections and resource exhaustion. When the request has not received a success or error
197+
response within the timeout period, the sender **SHOULD** issue a [cancellation
198+
notification]({{< ref "utilities/cancellation" >}}) for that request and stop waiting for
199+
a response.
200+
201+
SDKs and other middleware **SHOULD** allow these timeouts to be configured on a
202+
per-request basis.
203+
204+
Implementations **MAY** choose to reset the timeout clock when receiving a [progress
205+
notification]({{< ref "utilities/progress" >}}) corresponding to the request, as this
206+
implies that work is actually happening. However, implementations **SHOULD** always
207+
enforce a maximum timeout, regardless of progress notifications, to limit the impact of a
208+
misbehaving client or server.
209+
193210
## Error Handling
194211

195212
Implementations **SHOULD** be prepared to handle these error cases:
196213

197214
- Protocol version mismatch
198215
- Failure to negotiate required capabilities
199-
- Initialize request timeout
200-
- Shutdown timeout
201-
202-
Implementations **SHOULD** implement appropriate timeouts for all requests, to prevent
203-
hung connections and resource exhaustion.
216+
- Request [timeouts](#timeouts)
204217

205218
Example initialization error:
206219

0 commit comments

Comments
 (0)