From 08c04147ba7664ad82dcb59184293bec8c0e728f Mon Sep 17 00:00:00 2001 From: Vitali Zaidman Date: Wed, 12 Feb 2025 23:45:01 -0800 Subject: [PATCH] increase ping-pong timeout before killing WS connection to DevTools (#49358) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49358 When the network is under strain, the code responsible for detecting if the inspector proxy's connection to the client has been lost may incorrectly assume the connection is dead. This false positive occurs because the system assumes that if a pong is not received within 5 seconds of a ping, the other side has disconnected. However, I was able to consistently reproduce scenarios where a delay of more than 5 seconds (even more than 20 seconds) was followed by a return to normal ping-pong communication without any issues. Since I can't think of any issues with increasing this number, I'm increasing it to 60s. Changelog: [General][Fixed] - Disconnections of DevTools when the network is under significant strain. Reviewed By: robhogan, huntie Differential Revision: D69523906 fbshipit-source-id: 50db1e7bbe690b42421bc226aa30fd6571ba2257 --- packages/dev-middleware/src/inspector-proxy/InspectorProxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js b/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js index 8c692f06e51..1eb6ab29a7c 100644 --- a/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js +++ b/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js @@ -37,7 +37,7 @@ const WS_DEBUGGER_URL = '/inspector/debug'; const PAGES_LIST_JSON_URL = '/json'; const PAGES_LIST_JSON_URL_2 = '/json/list'; const PAGES_LIST_JSON_VERSION_URL = '/json/version'; -const MAX_PONG_LATENCY_MS = 5000; +const MAX_PONG_LATENCY_MS = 60000; const DEBUGGER_HEARTBEAT_INTERVAL_MS = 10000; const INTERNAL_ERROR_CODE = 1011;