Improve diagnostics when the packager cannot be reached or used - #58519
Open
javache wants to merge 1 commit into
Open
Improve diagnostics when the packager cannot be reached or used#58519javache wants to merge 1 commit into
javache wants to merge 1 commit into
Conversation
Summary: Three gaps made an unusable packager connection close to impossible to diagnose from logs. `ReconnectingWebSocket` logged only `Couldn't connect to "<url>", will silently retry`, discarding the `Throwable` that `onFailure` already receives. That throwable is the only thing separating a server which rejected the WebSocket upgrade from one that was never reached — okhttp reports the former as `Expected HTTP 101 response but was '<code> <message>'` — so without it the two produced byte-identical output. It is now logged, and `onClosed` distinguishes a peer-side close by including its code and reason. `ReactHostImpl` silently falls back to the bundle shipped inside the app when `useDevSupport` is true but `allowPackagerServerAccess` is false. No packager request is issued in that state, so nothing downstream has anything to report, and the app appears to ignore a perfectly healthy development server for no visible reason. That combination now warns; the existing debug log is kept for the ordinary case where dev support is off too. Also repairs a comment in `ReactHostImpl` that had unrelated text spliced into the middle of a word. No public API changes, so `ReactAndroid.api` is unaffected. Changelog: [Android][Fixed] - Log the underlying cause when a packager connection fails [Android][Added] - Warn when dev support is enabled but packager server access is disabled Differential Revision: D119721144
|
@javache has exported this pull request. If you are a Meta employee, you can view the originating Diff in D119721144. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Three gaps made an unusable packager connection close to impossible to
diagnose from logs.
ReconnectingWebSocketlogged onlyCouldn't connect to "<url>", will silently retry, discarding theThrowablethatonFailurealreadyreceives. That throwable is the only thing separating a server which
rejected the WebSocket upgrade from one that was never reached — okhttp
reports the former as
Expected HTTP 101 response but was '<code> <message>'— so without it the two produced byte-identical output. It is now logged, and
onCloseddistinguishes a peer-side close by including its code and reason.ReactHostImplsilently falls back to the bundle shipped inside the app whenuseDevSupportis true butallowPackagerServerAccessis false. No packagerrequest is issued in that state, so nothing downstream has anything to
report, and the app appears to ignore a perfectly healthy development server
for no visible reason. That combination now warns; the existing debug log is
kept for the ordinary case where dev support is off too.
Also repairs a comment in
ReactHostImplthat had unrelated text splicedinto the middle of a word.
No public API changes, so
ReactAndroid.apiis unaffected.Changelog:
[Android][Fixed] - Log the underlying cause when a packager connection fails
[Android][Added] - Warn when dev support is enabled but packager server access is disabled
Differential Revision: D119721144