Repository navigation
fix(client): set default timeouts and bound the oauth token request - #722
Conversation
🔴 Risk Classification: MAJORApproval route: AI Review + Human Approval Required Classification reasons
Operational gates
Files analysed: 4 wall-e 2026.06.19-02 · policy |
🔬 Debug — why this classification?Each reason code emitted by the classifier, its source clause in the AI in SDLC Control Framework, and what it means.
Kinds:
See issue #3 for the proposal to formalise this map as Appendix A of the standards doc. wall-e 2026.06.19-02 · debug |
🔵 Advisory review: Sound, but needs your judgementThis PR needs a human approval. The code itself reads as correct; whether it should land depends on context I don't have. This PR adds default timeouts (10s connect, 60s connection-request, 60s socket) to the SDK's built-in HttpClientBuilder and a 60s deadline abort for OAuth token requests when the caller-supplied builder lacks explicit timeouts. The implementation looks technically sound, but several design decisions with real operational consequences deserve explicit team sign-off. For you to decide
This is not an approval. wall-e cannot auto-approve this PR — it is an opinion to help whoever does. Advisory review · us.anthropic.claude-sonnet-4-6 · wall-e 2026.06.19-02 |
ec24067 to
63a310e
Compare
🔴 Risk Classification: MAJORApproval route: AI Review + Human Approval Required Classification reasons
Operational gates
Files analysed: 4 wall-e 2026.06.19-02 · policy |
🔬 Debug — why this classification?Each reason code emitted by the classifier, its source clause in the AI in SDLC Control Framework, and what it means.
Kinds:
See issue #3 for the proposal to formalise this map as Appendix A of the standards doc. wall-e 2026.06.19-02 · debug |
63a310e to
4524b0e
Compare
🔴 Risk Classification: MAJORApproval route: AI Review + Human Approval Required Classification reasons
Operational gates
Files analysed: 4 wall-e 2026.06.19-02 · policy |
🔬 Debug — why this classification?Each reason code emitted by the classifier, its source clause in the AI in SDLC Control Framework, and what it means.
Kinds:
See issue #3 for the proposal to formalise this map as Appendix A of the standards doc. wall-e 2026.06.19-02 · debug |
4524b0e to
01c9c80
Compare
🔴 Risk Classification: MAJORApproval route: AI Review + Human Approval Required Classification reasons
Operational gates
Files analysed: 4 wall-e 2026.06.19-02 · policy |
🔬 Debug — why this classification?Each reason code emitted by the classifier, its source clause in the AI in SDLC Control Framework, and what it means.
Kinds:
See issue #3 for the proposal to formalise this map as Appendix A of the standards doc. wall-e 2026.06.19-02 · debug |
01c9c80 to
d3aef24
Compare
🔴 Risk Classification: MAJORApproval route: AI Review + Human Approval Required Classification reasons
Operational gates
Files analysed: 4 wall-e 2026.06.19-02 · policy |
🔬 Debug — why this classification?Each reason code emitted by the classifier, its source clause in the AI in SDLC Control Framework, and what it means.
Kinds:
See issue #3 for the proposal to formalise this map as Appendix A of the standards doc. wall-e 2026.06.19-02 · debug |
d3aef24 to
4806921
Compare
🔴 Risk Classification: MAJORApproval route: AI Review + Human Approval Required Classification reasons
Operational gates
Files analysed: 4 wall-e 2026.06.19-02 · policy |
🔬 Debug — why this classification?Each reason code emitted by the classifier, its source clause in the AI in SDLC Control Framework, and what it means.
Kinds:
See issue #3 for the proposal to formalise this map as Appendix A of the standards doc. wall-e 2026.06.19-02 · debug |
The HTTP client builder created by the SDK had no request configuration, so a server that accepted the connection and never answered kept the caller waiting with no limit, on the API requests and on the OAuth token requests. Behaviour change: the builder the SDK creates now sets a connect timeout of 10 seconds, a connection request timeout of 60 seconds and a socket timeout of 60 seconds, so a request that gets no response fails instead of waiting. The connection request timeout matches the socket timeout because the default pool has 2 connections per host: a shorter wait would fail a request queued behind two slow ones before it is sent. The OAuth token requests use the same builder, so they get the same bounds. A builder passed through httpClientBuilder(...) is used unchanged; set timeouts on it with setDefaultRequestConfig.
The token request copies the request configuration of the client, so with an HttpClientBuilder passed to httpClientBuilder(...) that sets no timeout it could wait with no limit. Token requests are serialized (one at a time per credentials, the first one inside build()), so a token request that never ends blocks every OAuth request of the application. When that configuration does not have a positive connect, connection request and socket timeout, the token request is now aborted after 60 seconds in total; a DNS lookup still running is not interrupted. The client configuration is used unchanged, so every timeout the merchant set, including a socket timeout set through a SocketConfig, still applies and ends the request first when it is shorter. The API requests still use the merchant builder as given.
4806921 to
3c1ce5e
Compare
🔴 Risk Classification: MAJORApproval route: AI Review + Human Approval Required Classification reasons
Operational gates
Files analysed: 4 wall-e 2026.06.19-02 · policy |
🔬 Debug — why this classification?Each reason code emitted by the classifier, its source clause in the AI in SDLC Control Framework, and what it means.
Kinds:
See issue #3 for the proposal to formalise this map as Appendix A of the standards doc. wall-e 2026.06.19-02 · debug |
|



Summary
The HTTP client builder the SDK creates had no request configuration, so a request to an API that accepted the connection and never answered kept the caller waiting with no limit, on the API requests and on the OAuth token requests. That builder now sets a 10 second connect timeout, a 60 second connection request timeout and a 60 second socket timeout, and an OAuth token request is bounded also when the application's own
HttpClientBuildersets no timeout.Changes
src/main/java/com/checkout/AbstractCheckoutSdkBuilder.java: the builder the SDK creates gets aRequestConfigwith connect 10 s, connection request 60 s and socket 60 s;httpClientBuilder(...)is unchanged and its javadoc says the defaults do not apply to a builder passed to it. The class, its public and protected methods andbuild()now have javadoc.src/main/java/com/checkout/OAuthSdkCredentials.java: the token request still uses the client configuration unchanged; when that configuration does not have a positive connect, connection request and socket timeout, the request is aborted after 60 seconds in total (a DNS lookup still running is not interrupted).README.md: a "Default timeouts" section with the values, the exceptions and how to set other timeouts; the customHttpClientBuilderexamples set timeouts.src/test/java/com/checkout/DefaultHttpClientTimeoutsTest.java(new).Most of the added lines are tests (469 of 761); 127 of the 156 lines added to
AbstractCheckoutSdkBuilderare the javadoc the class needs once it is touched.Design notes: the API requests use a builder passed to
httpClientBuilder(...)as given; the SDK does not change a client the application configured, andHttpClientBuilderhas no getter to merge with it. The token request must not wait with no limit whatever the builder: token requests are serialized (one at a time per credentials, the first one insidebuild()), so one that never ends blocks every OAuth request of the application, while a hung API request blocks only its caller. So a client that does not bound every wait gets a deadline for the whole token request instead of changed timeouts: every timeout the application set, including a socket timeout set through aSocketConfig, which the built client does not expose, still applies. Apache HttpClient 4 has no total request timeout, so the deadline aborts the request from one shared daemon thread. When the builder leaves any of the three unset, the deadline also caps a timeout it sets above 60 seconds; the README says to set all three to keep longer values. With the builder the SDK creates, or one that sets all three, no deadline is scheduled: each wait of the HTTP client is bounded (the DNS lookup is not one of them and keeps the system resolver's limits), but a server that keeps sending data slowly can hold a token request longer than 60 seconds. The default socket timeout is a limit between packets, as the Python SDK's 60 second read timeout between bytes; only the token deadline is a total. A deadline that fires while the token response body is being read surfaces as an invalid token response, still aCheckoutAuthorizationException, without the cause, like any token response body that cannot be read. The Go SDK bounds the token request at 5 seconds when its client sets noTimeout; here the deadline is 60 seconds, the same as the socket timeout, because it only applies to the merchant's own client (the builder the SDK creates gets none) and is a backstop for that transport, not a tighter limit than the merchant's own settings would give. No timeout setters are added to the SDK builder, since they could not be combined withhttpClientBuilder(...). Package-private overloads (defaultHttpClientBuilder(RequestConfig),OAuthSdkCredentialsconstructors with the deadline and with the scheduler that runs it) let the tests run the same code with a short bound; the public API is unchanged. The deadline thread has no context class loader and ends 5 seconds after the last pending deadline; while it runs it keeps the SDK classes loaded, so a redeployed application releases them a few seconds after its last token request. The connection request timeout is 60 seconds, the same as the socket timeout: the default pool has 2 connections per host, so a shorter wait would fail a request queued behind two slow ones before it is sent.API Reference
None. No request or response changes.
Breaking changes
None in the public signatures. Behaviour changes, released as a minor version (a correction of requests that could wait with no limit):
CheckoutApiException(status 400, with the default transport configuration), or aCheckoutAuthorizationExceptionfor a token request, instead of waiting with no limit. This cannot be kept as before: the bound is the fix. Migration: to use other timeouts, pass a builder withsetDefaultRequestConfigthroughhttpClientBuilder(...).httpClientBuilder(...)that does not set a positive connect, connection request and socket timeout, a token request that has not finished after 60 seconds is aborted with aCheckoutAuthorizationException. The builder's own timeouts are unchanged. This cannot be kept as before: token requests are serialized, so one with no limit blocks every OAuth request of the application. Migration: none needed; to bound the token requests differently, set all three timeouts withsetDefaultRequestConfig.Tests
DefaultHttpClientTimeoutsTestchecks the defaults on the builder the SDK creates (static keys, OAuth and the previous platform), that they are kept after the SDK is built, a custom builder used unchanged and its request configuration kept, the configuration of the token and API requests (default timeouts, redirects off on the token request; a custom builder's configuration unchanged; a client without configuration falls back toRequestConfig.DEFAULTwith redirects off), and, against a local server that accepts the connection and never answers: an API request (CheckoutApiException); the token request with the builder the SDK creates (ends on its own socket timeout); aborted at the deadline, with the abort as the cause, with a custom builder without timeouts, with timeouts of 0, with one timeout unset and another longer than the deadline, and with exactly one of the connect, connection request or socket timeouts unset and the other two longer (one case each); no deadline when the client bounds every wait (ends on its socket timeout, not on an abort); and a custom socket timeout set throughRequestConfigorSocketConfigkept; each token case fails withCheckoutAuthorizationExceptionwithin the bound. It also checks that the deadline is cancelled and removed from its scheduler when the token request ends, and that the deadline scheduler lets its thread end when idle, removes cancelled deadlines and creates a daemon thread without a context class loader.Related
None.