Fix EDT freezes when opening embedded DevTools and on theme change#8477
Closed
Copilot wants to merge 3 commits into
Closed
Fix EDT freezes when opening embedded DevTools and on theme change#8477Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Copilot
AI
changed the title
[WIP] ⚡️ Prevent EDT freeze on theme change by using a shared scheduler
Fix EDT freeze in sendThemeChangedEvent by using shared ScheduledExecutorService
Aug 20, 2025
d346a5a to
9c6ed7f
Compare
Member
|
Apparently, Google's CLA is not ready for the Copilot yet. :) |
jwren
pushed a commit
that referenced
this pull request
Aug 23, 2025
… changed and opening embedded DevTools (#8479) *(originally with #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 #7794 - Fixes #8394 - Fixes #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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Notes
Fixes
Testing