Opened 2 years ago
Last modified 2 years ago
#22491 new defect
EDT violation in PluginHandler
Reported by: | gaben | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | |
Keywords: | template_report edt | Cc: |
Description
What steps will reproduce the problem?
- Just jumped around the plugin tab in the settings. Cannot reproduce :(
What is the expected result?
No EDT violations.
What happens instead?
Multiple EDT violations.
Please provide any additional information below. Attach a screenshot if possible.
Revision:18585 Is-Local-Build:true Build-Date:2022-11-06 23:52:18 Identification: JOSM/1.5 (18585 SVN hu) Linux Ubuntu 20.04.5 LTS Memory Usage: 191 MB / 2480 MB (82 MB allocated, but free) Java version: 11.0.16+8-post-Ubuntu-0ubuntu120.04, Ubuntu, OpenJDK 64-Bit Server VM Look and Feel: javax.swing.plaf.metal.MetalLookAndFeel Screen: :0.0 1914×1016 (scaling 1.00×1.00) Maximum Screen Size: 1914×1016 Best cursor sizes: 16×16→16×16, 32×32→32×32 Environment variable LANG: hu_HU.UTF-8 System property file.encoding: UTF-8 System property sun.jnu.encoding: UTF-8 Locale info: hu_HU Numbers with default locale: 1234567890 -> 1234567890 Desktop environment: ubuntu:GNOME Java package: openjdk-11-jre:amd64-11.0.16+8-0ubuntu1~20.04 Java ATK Wrapper package: libatk-wrapper-java:all-0.37.1-1 fonts-noto: fonts-noto:- VM arguments: [-javaagent:/home/<username>/progs/idea/plugins/java/lib/rt/debugger-agent.jar, -Dfile.encoding=UTF-8]
JOSM printed this error message 21 times in the debugger's log.
2022-11-06 23:52:42.686 SEVERE: EDT violation detected 2022-11-06 23:52:42.710 SEVERE: javax.swing.JPanel[,0,0,0x0,invalid,layout=java.awt.GridBagLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=] 2022-11-06 23:52:42.710 SEVERE: at java.base/java.lang.Thread.getStackTrace(Thread.java:1602) 2022-11-06 23:52:42.710 SEVERE: at org.openstreetmap.josm.gui.util.CheckThreadViolationRepaintManager.checkThreadViolations(CheckThreadViolationRepaintManager.java:54) 2022-11-06 23:52:42.710 SEVERE: at org.openstreetmap.josm.gui.util.CheckThreadViolationRepaintManager.addDirtyRegion(CheckThreadViolationRepaintManager.java:45) 2022-11-06 23:52:42.710 SEVERE: at java.desktop/javax.swing.JComponent.repaint(JComponent.java:4836) 2022-11-06 23:52:42.711 SEVERE: at java.desktop/java.awt.Component.repaint(Component.java:3393) 2022-11-06 23:52:42.711 SEVERE: at java.desktop/javax.swing.JComponent.setFont(JComponent.java:2773) 2022-11-06 23:52:42.711 SEVERE: at java.desktop/javax.swing.LookAndFeel.installColorsAndFont(LookAndFeel.java:209) 2022-11-06 23:52:42.711 SEVERE: at java.desktop/javax.swing.plaf.basic.BasicPanelUI.installDefaults(BasicPanelUI.java:77) 2022-11-06 23:52:42.711 SEVERE: at java.desktop/javax.swing.plaf.basic.BasicPanelUI.installUI(BasicPanelUI.java:62) 2022-11-06 23:52:42.711 SEVERE: at java.desktop/javax.swing.JComponent.setUI(JComponent.java:685) 2022-11-06 23:52:42.712 SEVERE: at java.desktop/javax.swing.JPanel.setUI(JPanel.java:150) 2022-11-06 23:52:42.712 SEVERE: at java.desktop/javax.swing.JPanel.updateUI(JPanel.java:126) 2022-11-06 23:52:42.712 SEVERE: at java.desktop/javax.swing.JPanel.<init>(JPanel.java:86) 2022-11-06 23:52:42.712 SEVERE: at java.desktop/javax.swing.JPanel.<init>(JPanel.java:95) 2022-11-06 23:52:42.712 SEVERE: at org.openstreetmap.josm.plugins.PluginHandler.getInfoPanel(PluginHandler.java:1608) 2022-11-06 23:52:42.712 SEVERE: at org.openstreetmap.josm.plugins.PluginHandler.installDownloadedPlugins(PluginHandler.java:1371) 2022-11-06 23:52:42.712 SEVERE: at org.openstreetmap.josm.plugins.PluginDownloadTask.realRun(PluginDownloadTask.java:184) 2022-11-06 23:52:42.713 SEVERE: at org.openstreetmap.josm.gui.PleaseWaitRunnable.doRealRun(PleaseWaitRunnable.java:94) 2022-11-06 23:52:42.713 SEVERE: at org.openstreetmap.josm.gui.PleaseWaitRunnable.run(PleaseWaitRunnable.java:142) 2022-11-06 23:52:42.713 SEVERE: at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) 2022-11-06 23:52:42.713 SEVERE: at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) 2022-11-06 23:52:42.713 SEVERE: at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) 2022-11-06 23:52:42.713 SEVERE: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 2022-11-06 23:52:42.714 SEVERE: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 2022-11-06 23:52:42.714 SEVERE: at java.base/java.lang.Thread.run(Thread.java:829)
Attachments (0)
Change History (2)
comment:1 by , 2 years ago
comment:2 by , 2 years ago
OK. I don't know if this is fixable without a significant rewrite. The code there is for plugins that want to be able to be updated without restarting.
Naive solution:
-
src/org/openstreetmap/josm/plugins/PluginHandler.java
diff --git a/src/org/openstreetmap/josm/plugins/PluginHandler.java b/src/org/openstreetmap/josm/plugins/PluginHandler.java
a b 1367 1367 if (tInfo != null) { 1368 1368 Object tUpdatedPlugin = getPlugin(tInfo.name); 1369 1369 if (tUpdatedPlugin instanceof Destroyable) { 1370 ((Destroyable) tUpdatedPlugin).destroy(); 1371 PluginHandler.loadPlugins(getInfoPanel(), Collections.singleton(tInfo), 1372 NullProgressMonitor.INSTANCE); 1370 GuiHelper.runInEDTAndWait(() -> { 1371 ((Destroyable) tUpdatedPlugin).destroy(); 1372 PluginHandler.loadPlugins(getInfoPanel(), Collections.singleton(tInfo), 1373 NullProgressMonitor.INSTANCE); 1374 }); 1373 1375 } 1374 1376 } 1375 1377 } catch (MalformedURLException e) {
Current testing methodology:
# Download an old Mapillary jar file to the plugin directory. I'm on Mac. Adjust for Windows/Linux. $ curl https://github.com/JOSM/Mapillary/releases/download/v2.0.0/Mapillary.jar -L -o ~/Library/JOSM/plugins/Mapillary.jar $ java -jar ${PATH_TO_JOSM_JAR} # Now open the plugin preferences panel and click on `Update plugins`
We might have deadlocks if a plugin runs anything in the worker thread during cleanup. Right now, it doesn't appear to be a problem, but it is something we are going to have to watch out for if we fix the EDT violations.
That is because it will only happen when you are updating plugins.
I've reproduced.