Skip to content

Conversation

@FliegendeWurst
Copy link
Member

Intended Change

It seems this method is called on the worker thread, which may lead to a deadlock when creating the dialog.

Type of pull request

  • Bug fix (non-breaking change which fixes an issue)

Ensuring quality

  • I have tested the feature as follows: loaded a file with JML warnings (specifically, missing decreases). Now works fine, previously it got stuck on "Reading project.key".

The contributions within this pull request are licensed under GPLv2 (only) for inclusion in KeY.

@FliegendeWurst FliegendeWurst added GUI Review Request Waiting for review labels Nov 26, 2025
@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.99%. Comparing base (1c76f67) to head (8a479c2).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #3692   +/-   ##
=========================================
  Coverage     47.99%   47.99%           
  Complexity    16044    16044           
=========================================
  Files          1683     1683           
  Lines         96044    96044           
  Branches      15387    15387           
=========================================
  Hits          46093    46093           
  Misses        44681    44681           
  Partials       5270     5270           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wadoon
Copy link
Member

wadoon commented Nov 26, 2025

I would say, that this is not the patch we would want in just a case.

Could you provide a stack trace showing the location from which the method is invoked?

@wadoon wadoon added this to the v2.13.0 milestone Nov 26, 2025
@wadoon wadoon self-requested a review November 26, 2025 21:30
@FliegendeWurst
Copy link
Member Author

Sure, here you go:

showWarningsIfNecessary:580, IssueDialog (de.uka.ilkd.key.gui)
reportWarnings:595, WindowUserInterfaceControl (de.uka.ilkd.key.gui)
loadEnvironment:309, AbstractProblemLoader (de.uka.ilkd.key.proof.io)
load:268, AbstractProblemLoader (de.uka.ilkd.key.proof.io)
doWork:75, ProblemLoader (de.uka.ilkd.key.proof.io)
doInBackground:125, ProblemLoader$1 (de.uka.ilkd.key.proof.io)
4 hidden frames
 - Async stack trace
2 hidden frames
<init>:118, ProblemLoader$1 (de.uka.ilkd.key.proof.io)
runAsynchronously:118, ProblemLoader (de.uka.ilkd.key.proof.io)
loadProblem:109, WindowUserInterfaceControl (de.uka.ilkd.key.gui)
loadProblem:114, WindowUserInterfaceControl (de.uka.ilkd.key.gui)
loadProblem:1400, MainWindow (de.uka.ilkd.key.gui)
actionPerformed:61, OpenFileAction (de.uka.ilkd.key.gui.actions)
49 hidden frames

@wadoon
Copy link
Member

wadoon commented Nov 28, 2025

I would say the responsibility for EDT is in WindowUserInterfaceControl#reportWarnings. This would be my patch.

diff --git a/key.ui/src/main/java/de/uka/ilkd/key/gui/WindowUserInterfaceControl.java b/key.ui/src/main/java/de/uka/ilkd/key/gui/WindowUserInterfaceControl.java
index 8f738947e8..5ab4910923 100644
--- a/key.ui/src/main/java/de/uka/ilkd/key/gui/WindowUserInterfaceControl.java
+++ b/key.ui/src/main/java/de/uka/ilkd/key/gui/WindowUserInterfaceControl.java
@@ -592,7 +592,9 @@ public class WindowUserInterfaceControl extends AbstractMediatorUserInterfaceCon
 
     @Override
     public void reportWarnings(ImmutableSet<PositionedString> warnings) {
-        IssueDialog.showWarningsIfNecessary(mainWindow, warnings);
+        SwingUtilities.invokeLater(() ->
+            IssueDialog.showWarningsIfNecessary(mainWindow, warnings)
+        );
     }
 
     /**

@FliegendeWurst FliegendeWurst force-pushed the fixUiDeadlockForJmlWarnings branch from ce417f5 to 5e877bd Compare December 1, 2025 16:05
@FliegendeWurst FliegendeWurst force-pushed the fixUiDeadlockForJmlWarnings branch from 5e877bd to 1c76f67 Compare December 2, 2025 12:57
@FliegendeWurst
Copy link
Member Author

Now the warnings dialog will be shown in parallel to the contract chooser, which is a bit odd.

Copy link
Member

@WolframPfeifer WolframPfeifer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the warnings dialog will be shown in parallel to the contract chooser, which is a bit odd.

In our meeting, we agreed that this is very difficult to prevent (probably involves writing a class that has an explicit queue of dialogs to show), so we decided to ignore that for the moment.
Thanks, @FliegendeWurst and @wadoon.

@WolframPfeifer WolframPfeifer dismissed their stale review December 3, 2025 14:56

Review was supposed to accept, not to request change ;-)

Copy link
Member

@WolframPfeifer WolframPfeifer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the warnings dialog will be shown in parallel to the contract chooser, which is a bit odd.

In our meeting, we decided to ignore that shortcoming, since a fix would be difficult (probably requires writing a class that keeps an explicit queue of dialogs to show).

Thanks, @FliegendeWurst and @wadoon!

@WolframPfeifer WolframPfeifer added this pull request to the merge queue Dec 3, 2025
Merged via the queue into KeYProject:main with commit fd9bc69 Dec 3, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GUI Review Request Waiting for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants