You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
- Fixesflutter#7794
- Fixesflutter#8394
- Fixesflutter#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.
0 commit comments