Commit 25f8e08
authored
Fix DTD freezes when opening projects, and EDT freezes when the theme changed and opening embedded DevTools (flutter#8479)
*(originally with
flutter#8477
Summary
- Fix frequent “Timed out waiting for DTD websocket to start” errors
when opening projects.
- Fix EDT freezes caused by:
- Synchronous JxBrowser Engine initialization when opening embedded
DevTools.
- Blocking ExecutorService lifecycle on theme change (JDK 21
ExecutorService.close() awaits termination).
Changes
- DtdUtils
- Refactor readyDtdService to be truly asynchronous using a shared
ScheduledExecutorService for periodic polling (no blocking).
- De-duplicate and cache the in-flight Future per Project to avoid
redundant polling under concurrency.
- Preserve an overall timeout (~20s by default). On timeout or error,
complete exceptionally and clear the cache to allow subsequent retries.
- EmbeddedJxBrowser.openEmbeddedTab:
- Avoid initializing JxBrowser Engine on the EDT; show “installation in
progress” UI until async init completes.
- This removes the fallback compareAndSet(null, getEngine()) path that
could call Engine.newInstance(...) on EDT and freeze it.
- FlutterInitializer.sendThemeChangedEvent:
- Send themeChanged asynchronously: remove .get() blocking; use a shared
scheduler with debounce.
- If DTD becomes ready later, the event is sent then; if it times out,
gracefully skip with debug-level logging (no startup errors).
- Use shared AppScheduledExecutor (AppExecutorUtil) instead of
creating/closing a new executor per event.
- Remove try-with-resources that triggers ExecutorService.close() on EDT
with JDK 21.
Notes
- Added comments explaining why Engine initialization must not occur on
EDT and how JDK 21 changed ExecutorService.close().
Fixes
- Fixes flutter#7794
- Fixes flutter#8394
- Fixes flutter#8478
Testing
- Manual:
- Open Flutter projects; no error logs about DTD timeout.
- Switch IDE themes repeatedly; no UI freeze.
- Open DevTools (embedded) after clean startup and after JxBrowser
installation completes; no EDT freeze, proper “installing...” UX during
setup.1 parent d478642 commit 25f8e08
File tree
5 files changed
+156
-75
lines changed- src/io/flutter
- dart
- jxbrowser
- testSrc/unit/io/flutter
5 files changed
+156
-75
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
| |||
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
62 | | - | |
63 | | - | |
| 61 | + | |
64 | 62 | | |
65 | 63 | | |
66 | 64 | | |
| |||
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| |||
253 | 255 | | |
254 | 256 | | |
255 | 257 | | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
262 | 263 | | |
263 | | - | |
264 | | - | |
265 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
266 | 267 | | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
272 | 273 | | |
273 | | - | |
274 | | - | |
275 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
276 | 277 | | |
277 | | - | |
278 | | - | |
279 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
280 | 281 | | |
281 | | - | |
| 282 | + | |
282 | 283 | | |
283 | 284 | | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
307 | 311 | | |
308 | 312 | | |
309 | 313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 26 | + | |
28 | 27 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
38 | 52 | | |
39 | 53 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
| 133 | + | |
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
| |||
173 | 175 | | |
174 | 176 | | |
175 | 177 | | |
176 | | - | |
| 178 | + | |
177 | 179 | | |
178 | | - | |
179 | | - | |
180 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
181 | 187 | | |
182 | 188 | | |
183 | | - | |
| 189 | + | |
| 190 | + | |
184 | 191 | | |
185 | 192 | | |
186 | | - | |
187 | | - | |
188 | | - | |
| 193 | + | |
189 | 194 | | |
190 | 195 | | |
191 | 196 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
0 commit comments