Repository navigation
Commit 268b302
Clear pages polling interval on device recreate (#58928)
Summary:
Pull Request resolved: #58928
`Device#dangerouslyRecreateDevice` overwrote `#pagesPollingIntervalId` without clearing the previous interval. The old device socket's `close` handler could not clear it either, because its `socket === #deviceSocket` guard fails once reconstruct points `#deviceSocket` at the new socket. Every device ID collision therefore leaked a ref'd 1s `getPages` polling timer: the new device received duplicate polls, and the event loop was kept alive (Jest suites covering device handoff never exited on their own).
Clear the previous polling interval before reconstructing. Clearing an already-cleared interval is a no-op, so the path where the old socket already closed is unaffected.
With the leak fixed, test suites that exercise device handoff exit on their own, so their results can be relied on without force-exiting Jest.
Changelog:
[General][Fixed] - Fix the inspector proxy leaking a pages polling timer, and sending duplicate `getPages` requests, each time a device reconnects with the same device ID
Differential Revision: D123883324
fbshipit-source-id: 3224453d2450dd2f1ab74283b7109d611d5a8e141 parent 618b844 commit 268b302
2 files changed
Lines changed: 50 additions & 0 deletions
File tree
- packages/dev-middleware/src
- __tests__
- inspector-proxy
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| |||
254 | 257 | | |
255 | 258 | | |
256 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
257 | 304 | | |
258 | 305 | | |
259 | 306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
304 | 307 | | |
305 | 308 | | |
306 | 309 | | |
| |||
0 commit comments