Skip to content

fix(router): request fails with unexpected use of stub RoundTripper error - #7386

Merged
atzoum merged 1 commit into
masterfrom
fix/router-transport-clone-go127
Sep 14, 2026
Merged

atzoum merged 1 commit into
masterfrom
fix/router-transport-clone-go127

Conversation

@atzoum

@atzoum atzoum commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

Router deliveries over HTTP/2 fail with 504 Unable to make "POST" request for URL ... unexpected use of stub RoundTripper after upgrading to Go 1.27.

Since Go 1.27, using a Transport keeps the real HTTP/2 transport in an unexported field and leaves only a placeholder in the exported TLSNextProto["h2"]. The router built its client by reflect-copying the exported fields of http.DefaultTransport (misc.Copy), so whenever the default transport had already served a request by the time a router was set up, the copy inherited the placeholder, never configured its own HTTP/2, and every h2 connection was dispatched to the placeholder. Introduced by the Go 1.27.1 bump in #7345; on Go ≤1.26 the map entry held a real round-tripper so the copy worked by accident.

We are now using the standard Transport.Clone(), which drops the auto-populated TLSNextProto so the clone configures HTTP/2 for itself and deep-clones TLSClientConfig so the forceHTTP1 path can edit it in place. misc.Copy had no other callers and is removed.

Adding TestSendPostProtocolNegotiation, which uses http.DefaultTransport before building the router client and then asserts an h2 delivery succeeds (reproduces the exact production error on the old code) and that forceHTTP1 still pins to HTTP/1.1 — neither path had a test.

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

@atzoum atzoum changed the title fix(router): clone http.DefaultTransport instead of copying its fields fix(router): request fails with unexpected use of stub RoundTripper error Sep 14, 2026

@fracasula fracasula left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but you have several checks failing.

Since Go 1.27, using a Transport keeps the real HTTP/2 transport in an
unexported field and leaves only a placeholder in the exported
TLSNextProto["h2"]. The router built its client by reflect-copying the
exported fields of http.DefaultTransport, so whenever the default
transport had already served a request by the time a router was set up,
the copy inherited the placeholder, never configured its own HTTP/2 and
failed every h2 delivery with "unexpected use of stub RoundTripper".
Surfaced on hosted with 1.87.0-rc after the Go 1.27.1 bump (#7345).

Transport.Clone drops the auto-populated TLSNextProto so the clone sets
HTTP/2 up for itself, and deep-clones TLSClientConfig so forceHTTP1 can
edit it in place. misc.Copy had no other callers and is removed.

Co-Authored-By: Claude Opus 5 <[email protected]>
@atzoum
atzoum force-pushed the fix/router-transport-clone-go127 branch from 02f03b7 to 10d73f1 Compare September 14, 2026 17:57
@atzoum
atzoum enabled auto-merge (squash) September 14, 2026 17:58
@atzoum
atzoum disabled auto-merge September 14, 2026 20:16
@atzoum
atzoum merged commit 2ff491f into master Sep 14, 2026
224 of 256 checks passed
@atzoum
atzoum deleted the fix/router-transport-clone-go127 branch September 14, 2026 20:16
This was referenced Sep 14, 2026
atzoum pushed a commit that referenced this pull request Sep 14, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.87.0-rc.3](v1.86.0...v1.87.0-rc.3)
(2026-09-14)


### Features

* backend config shadow mode
([#7340](#7340))
([4898165](4898165))
* bump rudder-go-kit and go modules to Go 1.27.1
([#7345](#7345))
([8d95c68](8d95c68))
* **router:** read transformerProxy from transformer features before env
([#7337](#7337))
([e8f0ea6](e8f0ea6))


### Bug Fixes

* **router:** redact credentials from destination URLs in failure
responses
([#7372](#7372))
([14659bf](14659bf))
* **router:** request fails with unexpected use of stub RoundTripper
error ([#7386](#7386))
([2ff491f](2ff491f))
* **warehouse:** instrument the clickhouse v2 load path
([#7355](#7355))
([4d743db](4d743db))
* **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy
engine
([#7353](#7353))
([4d743db](4d743db))
* **warehouse:** retire idle clickhouse v2 connections
([#7352](#7352))
([4d743db](4d743db))
* **warehouse:** retry a failed clickhouse v2 block
([#7354](#7354))
([4d743db](4d743db))


### Miscellaneous

* log the candidate error when a backend config shadow sample fails to
fetch ([#7383](#7383))
([eaa9b61](eaa9b61))
* **processor:** assemble side-PU report metrics at end of preprocess
stage ([#7346](#7346))
([4540876](4540876))
* sync release v1.86.0 to main branch
([#7356](#7356))
([6868c6c](6868c6c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
This was referenced Sep 15, 2026
atzoum pushed a commit that referenced this pull request Sep 15, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.87.0-rc.4](v1.86.0...v1.87.0-rc.4)
(2026-09-15)


### Features

* backend config shadow mode
([#7340](#7340))
([4898165](4898165))
* bump rudder-go-kit and go modules to Go 1.27.1
([#7345](#7345))
([8d95c68](8d95c68))
* **router:** read transformerProxy from transformer features before env
([#7337](#7337))
([e8f0ea6](e8f0ea6))


### Bug Fixes

* **batchrouter:** retry failed async manager initialization
([#7374](#7374))
([974d383](974d383))
* **router:** redact credentials from destination URLs in failure
responses
([#7372](#7372))
([14659bf](14659bf))
* **router:** request fails with unexpected use of stub RoundTripper
error ([#7386](#7386))
([2ff491f](2ff491f))
* singer-protocol sources filtered destination config for source type
cloud instead of cloudSource
([#7389](#7389))
([f48c997](f48c997))
* **warehouse:** instrument the clickhouse v2 load path
([#7355](#7355))
([4d743db](4d743db))
* **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy
engine
([#7353](#7353))
([4d743db](4d743db))
* **warehouse:** retire idle clickhouse v2 connections
([#7352](#7352))
([4d743db](4d743db))
* **warehouse:** retry a failed clickhouse v2 block
([#7354](#7354))
([4d743db](4d743db))


### Miscellaneous

* log the candidate error when a backend config shadow sample fails to
fetch ([#7383](#7383))
([eaa9b61](eaa9b61))
* **processor:** assemble side-PU report metrics at end of preprocess
stage ([#7346](#7346))
([4540876](4540876))
* sync release v1.86.0 to main branch
([#7356](#7356))
([6868c6c](6868c6c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
atzoum pushed a commit that referenced this pull request Sep 15, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.87.0](v1.86.0...v1.87.0)
(2026-09-15)


### Features

* backend config shadow mode
([#7340](#7340))
([4898165](4898165))
* bump rudder-go-kit and go modules to Go 1.27.1
([#7345](#7345))
([8d95c68](8d95c68))
* **router:** read transformerProxy from transformer features before env
([#7337](#7337))
([e8f0ea6](e8f0ea6))


### Bug Fixes

* **batchrouter:** retry failed async manager initialization
([#7374](#7374))
([974d383](974d383))
* **router:** redact credentials from destination URLs in failure
responses
([#7372](#7372))
([14659bf](14659bf))
* **router:** request fails with unexpected use of stub RoundTripper
error ([#7386](#7386))
([2ff491f](2ff491f))
* singer-protocol sources filtered destination config for source type
cloud instead of cloudSource
([#7389](#7389))
([f48c997](f48c997))
* **warehouse:** instrument the clickhouse v2 load path
([#7355](#7355))
([4d743db](4d743db))
* **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy
engine
([#7353](#7353))
([4d743db](4d743db))
* **warehouse:** retire idle clickhouse v2 connections
([#7352](#7352))
([4d743db](4d743db))
* **warehouse:** retry a failed clickhouse v2 block
([#7354](#7354))
([4d743db](4d743db))


### Miscellaneous

* log the candidate error when a backend config shadow sample fails to
fetch ([#7383](#7383))
([eaa9b61](eaa9b61))
* **processor:** assemble side-PU report metrics at end of preprocess
stage ([#7346](#7346))
([4540876](4540876))
* sync release v1.86.0 to main branch
([#7356](#7356))
([6868c6c](6868c6c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants