Repository navigation
Commit 96a401c
authored
[web] Fix hang when Chromium cannot bind remote debugging port (flutter#193461)
When Chromium cannot bind its assigned remote debugging port (e.g.
because the port is already in use on loopback), it logs `Cannot start
http server for devtools.` to stderr and stays alive without printing
`DevTools listening`.
Previously, `ChromiumLauncher._spawnChromiumProcess` awaited
`devToolsListening.future` indefinitely without a timeout or failure
detection, causing `flutter test --platform chrome` and `flutter run -d
chrome` to hang indefinitely. Furthermore, the debugging port was
selected once before the retry loop, and failed Chrome processes were
left alive across retries, causing subsequent attempts to hit Chromium's
`SingletonLock` on the profile directory.
This change:
1. Detects `Cannot start http server for devtools.` in Chrome stderr to
fail fast without waiting.
2. Adds a 30-second timeout backstop (`kDevToolsListeningTimeout`) while
waiting for `DevTools listening`.
3. Selects a fresh debugging port on each retry attempt via
`findFreePort()`.
4. Immediately sends `process.kill()` to the failed process and awaits
its termination before starting the next attempt so that it releases its
remote debugging port and profile lock.
Fixes flutter#192013
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant in-code documentation (doc comments with
`///`).
- [ ] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.1 parent 4956c97 commit 96a401c
2 files changed
Lines changed: 187 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
55 | 72 | | |
56 | 73 | | |
57 | 74 | | |
| |||
242 | 259 | | |
243 | 260 | | |
244 | 261 | | |
245 | | - | |
246 | | - | |
| 262 | + | |
247 | 263 | | |
248 | 264 | | |
249 | 265 | | |
| |||
299 | 315 | | |
300 | 316 | | |
301 | 317 | | |
302 | | - | |
| 318 | + | |
303 | 319 | | |
| 320 | + | |
304 | 321 | | |
305 | 322 | | |
306 | 323 | | |
| |||
330 | 347 | | |
331 | 348 | | |
332 | 349 | | |
333 | | - | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
334 | 359 | | |
335 | 360 | | |
336 | 361 | | |
337 | 362 | | |
338 | 363 | | |
339 | 364 | | |
| 365 | + | |
| 366 | + | |
340 | 367 | | |
341 | 368 | | |
342 | 369 | | |
| |||
374 | 401 | | |
375 | 402 | | |
376 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
377 | 413 | | |
378 | 414 | | |
379 | 415 | | |
| |||
389 | 425 | | |
390 | 426 | | |
391 | 427 | | |
392 | | - | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
393 | 435 | | |
394 | 436 | | |
395 | 437 | | |
396 | 438 | | |
397 | 439 | | |
398 | 440 | | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
399 | 444 | | |
400 | 445 | | |
401 | 446 | | |
| |||
407 | 452 | | |
408 | 453 | | |
409 | 454 | | |
410 | | - | |
| 455 | + | |
411 | 456 | | |
412 | 457 | | |
413 | 458 | | |
414 | 459 | | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
431 | 475 | | |
432 | 476 | | |
433 | 477 | | |
| |||
733 | 777 | | |
734 | 778 | | |
735 | 779 | | |
736 | | - | |
| 780 | + | |
737 | 781 | | |
| 782 | + | |
738 | 783 | | |
739 | 784 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
835 | 835 | | |
836 | 836 | | |
837 | 837 | | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
838 | 947 | | |
839 | 948 | | |
840 | 949 | | |
| |||
1186 | 1295 | | |
1187 | 1296 | | |
1188 | 1297 | | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
0 commit comments