Skip to content

Give devsupport networking its own dispatcher and pool (#58094) - #58094

Open
javache wants to merge 1 commit into
react:mainfrom
javache:export-D117196401
Open

Give devsupport networking its own dispatcher and pool (#58094)#58094
javache wants to merge 1 commit into
react:mainfrom
javache:export-D117196401

Conversation

@javache

@javache javache commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary:

DevSupportHttpClient derived its clients from the app's shared OkHttpClient with newBuilder(), which shares the underlying Dispatcher and ConnectionPool.

Dev support keeps several long-lived WebSockets open to the dev server — the packager connection and the inspector among them — and a WebSocket occupies a running-call slot for its entire lifetime, because RealWebSocket.loopReader runs inside RealCall.AsyncCall.execute. OkHttp allows five concurrent calls per host by default, so those sockets throttle, and eventually stall, every other request to the dev server: BundleDownloader fetching the bundle itself, PackagerStatusCheck, and any application request that happens to target the same host.

Give the devsupport clients a Dispatcher and a ConnectionPool of their own, still configured from the shared client so an OkHttpClientFactory override continues to apply. The per-host limit is raised on that dispatcher as well — without it the WebSockets would simply starve bundle traffic on the new dispatcher instead of the app's.

Changelog:
[Android][Fixed] - Stop dev server WebSockets from throttling bundle downloads and other dev server requests

Reviewed By: cortinico

Differential Revision: D117196401

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 24, 2026
@meta-codesync

meta-codesync Bot commented Aug 24, 2026

Copy link
Copy Markdown

@javache has exported this pull request. If you are a Meta employee, you can view the originating Diff in D117196401.

@cortinico cortinico left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

Summary:

`DevSupportHttpClient` derived its clients from the app's shared `OkHttpClient` with `newBuilder()`, which shares the underlying `Dispatcher` and `ConnectionPool`.

Dev support keeps several long-lived WebSockets open to the dev server — the packager connection and the inspector among them — and a WebSocket occupies a running-call slot for its entire lifetime, because `RealWebSocket.loopReader` runs inside `RealCall.AsyncCall.execute`. OkHttp allows five concurrent calls per host by default, so those sockets throttle, and eventually stall, every other request to the dev server: `BundleDownloader` fetching the bundle itself, `PackagerStatusCheck`, and any application request that happens to target the same host.

Give the devsupport clients a `Dispatcher` and a `ConnectionPool` of their own, still configured from the shared client so an `OkHttpClientFactory` override continues to apply. The per-host limit is raised on that dispatcher as well — without it the WebSockets would simply starve bundle traffic on the new dispatcher instead of the app's.

Changelog:
[Android][Fixed] - Stop dev server WebSockets from throttling bundle downloads and other dev server requests

Reviewed By: cortinico

Differential Revision: D117196401
@meta-codesync meta-codesync Bot changed the title Give devsupport networking its own dispatcher and pool Give devsupport networking its own dispatcher and pool (#58094) Aug 24, 2026
@javache
javache force-pushed the export-D117196401 branch from 897b910 to eca0577 Compare August 24, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants