Repository navigation
Commit cab3ea7
authored
[flutter_tools] Retry chromedriver startup when its port is taken (flutter#196150)
Follow-up to flutter#194419.
On Linux, `chromedriver --port=0` [binds `::1`
first](https://github.com/chromium/chromium/blob/de4e5d6e13b995f5e04137970c0e8ec456017467/chrome/test/chromedriver/server/chromedriver_server.cc#L172-L175)
and then [binds `127.0.0.1` on the same port, exiting if it's
taken](https://github.com/chromium/chromium/blob/de4e5d6e13b995f5e04137970c0e8ec456017467/chrome/test/chromedriver/server/chromedriver_server.cc#L225-L231).
The port the OS picks for `::1` can still be in use on `127.0.0.1`, so
`hot_reload_web_server_test` and `hot_restart_web_server_test`
occasionally fail with:
```
chromedriver stdout: IPv4 port not available. Exiting...
```
Example CI failures:
- https://ci.chromium.org/b/8666997626110753073
- https://ci.chromium.org/b/8665892656502980097
This PR restarts chromedriver (up to 3 attempts) when it exits with that
message. Each attempt gets a new port from the OS. I reproduced it
locally by holding some IPv4 ports in a network namespace with a narrow
ephemeral port range: successful launches went from 9/15 to 14/15.
ChromeDriver bug: https://issues.chromium.org/issues/582923020
Part of flutter#1943131 parent 236153d commit cab3ea7
1 file changed
Lines changed: 43 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
66 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
67 | 92 | | |
68 | 93 | | |
69 | 94 | | |
| 95 | + | |
70 | 96 | | |
71 | 97 | | |
72 | 98 | | |
73 | 99 | | |
74 | 100 | | |
75 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
76 | 105 | | |
77 | 106 | | |
78 | 107 | | |
| |||
90 | 119 | | |
91 | 120 | | |
92 | 121 | | |
93 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
94 | 128 | | |
95 | 129 | | |
96 | 130 | | |
| |||
219 | 253 | | |
220 | 254 | | |
221 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
0 commit comments