Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not run the InfoTextSwingWorker on the EDT thread #4802

Merged

Conversation

kwvanderlinde
Copy link
Collaborator

@kwvanderlinde kwvanderlinde commented May 26, 2024

Identify the Bug or Feature request

Fixes #4801

Description of the Change

This changes the data gathering task for Gather Debug Information... to run on a background thread rather than the EDT thread. The dialog as a result now shows the text "Gathering information, please wait..." until the dialog is populated, rather than being blank. The dialog also no longer hangs indefinitely.

The reason we previously got away with running that task on the EDT thread is that SwingWorker would always run the done() method after the internal FutureTask<> completes, so the get() method would have a result to return. But since Java 21, it runs done() as part of the FutureTask<> callback if running on the EDT thread, i.e., it runs done() before the task completes. The get() call therefore blocks as it has no result yet, and the task is blocked from completing and providing those results.

I audited the rest of our SwingWorker tasks, but they are all run via .execute() and thus are safe from this issue. Only one task (RenderPathWorker) is run in a dfiferent manner, but it is on its own non-EDT executor. One unnecessary usage of that worker was found and removed though.

Possible Drawbacks

None

Documentation Notes

N/A

Release Notes

  • Fixed a bug where Gather Debug Information... would permanently hang MapTool.

This change is Reviewable

It's meant to be run off-thread, so use `.execute()` instead of `.run()`.
@kwvanderlinde kwvanderlinde self-assigned this May 26, 2024
@kwvanderlinde
Copy link
Collaborator Author

Targetting the 1.15 release with this one so bugs can be properly reported for that version.

@cwisniew cwisniew merged commit 164a0c3 into RPTools:release-1.15 May 27, 2024
4 checks passed
@kwvanderlinde kwvanderlinde deleted the bugfix/4801-debug-information branch May 28, 2024 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

[Bug]: Opening the Gather Debug Information dialog hangs the application
2 participants