Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#21462 closed defect (fixed)

Deadlock - Can't import a gpx/pos file after a .pos import

Reported by: StephaneP Owned by: marcello@…
Priority: major Milestone: 21.10
Component: Core Version:
Keywords: template_report deadlock regression Cc:

Description

What steps will reproduce the problem?

  1. import a .pos file (use the .pos in the attached archive)
  2. import a .gpx file (use the .gpx in the attached archive)

What happens instead?

Josm freeze when trying to import the .gpx file. It works if I don't import the .pos at first. Strangely I can't reproduce the problem with the examples from this ticket https://josm.openstreetmap.de/ticket/17829 but I can reproduce it with other .pos .gpx files.

Please provide any additional information below. Attach a screenshot if possible.

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2021-10-21 23:23:31 +0200 (Thu, 21 Oct 2021)
Revision:18289
Build-Date:2021-10-22 01:31:04
URL:https://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (18289 en) Windows 10 64-Bit
OS Build number: Windows 10 Pro 2009 (19043)
Memory Usage: 248 MB / 16384 MB (145 MB allocated, but free)
Java version: 18-ea+17-1015, Oracle Corporation, OpenJDK 64-Bit Server VM
Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
Screen: \Display0 1920×1080 (scaling 1.00×1.00)
Maximum Screen Size: 1920×1080
Best cursor sizes: 16×16→32×32, 32×32→32×32
System property file.encoding: UTF-8
System property sun.jnu.encoding: Cp1252
Locale info: en_FR
Numbers with default locale: 1234567890 -> 1234567890

Plugins:
+ DxfImport (1014)
+ Mapillary (2.0.0-alpha.38)
+ OpeningHoursEditor (35640)
+ PicLayer (1.0.1)
+ apache-commons (35524)
+ apache-http (35589)
+ areaselector (368)
+ austriaaddresshelper (1597341117)
+ cadastre-fr (35831)
+ continuosDownload (99)
+ contourmerge (v0.1.8)
+ ejml (35458)
+ geotools (35458)
+ jaxb (35543)
+ jna (35662)
+ jts (35458)
+ log4j (35458)
+ measurement (35640)
+ opendata (35803)
+ photo_geotagging (35783)
+ photoadjust (35770)
+ reverter (35732)
+ shrinkwrap (v1.0.4)
+ tageditor (35640)
+ todo (30306)
+ turnlanes-tagging (288)
+ turnrestrictions (35640)
+ undelete (35640)
+ utilsplugin2 (35792)

Tagging presets:
+ H:\Gares21\gares21\JOSM\Gares21-preset.xml

Map paint styles:
+ H:\Gares21\gares21\JOSM\railway-station.mapcss
- https://josm.openstreetmap.de/josmfile?page=Styles/Enhanced_Lane_and_Road_Attributes&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1
- https://raw.githubusercontent.com/species/josm-preset-traffic_sign_direction/master/direction.mapcss
- %UserProfile%\Documents\GitHub\MapCSS-JOSM-Bicycle\cycleway.mapcss
- https://josm.openstreetmap.de/josmfile?page=Styles/iD&zip=1
- https://github.com/bastik/mapcss-tools/raw/osm/mapnik2mapcss/osm-results/mapnik.zip
- https://josm.openstreetmap.de/josmfile?page=Styles/NewHighwayColors&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Styles/SidewalksPlus&zip=1

Validator rules:
+ H:\Gares21\gares21\JOSM\railway-station.validator.mapcss

Last errors/warnings:
- 00007.740 E: Failed to locate image 'styles/standard/misc/entrance-main.png'
- 00007.744 W:  Entrée-sortie de gare: Could not get presets icon styles/standard/misc/entrance-main.png
- 00007.745 E: Failed to locate image 'presets/frame.png'
- 00007.746 W:  Indoor area: Could not get presets icon presets/frame.png
- 00007.747 E: Failed to locate image 'presets/frame.png'
- 00007.748 W:  Indoor wall: Could not get presets icon presets/frame.png
- 00007.749 E: Failed to locate image 'presets/platform_rail.png'
- 00007.750 W:  Quai ferroviaire: Could not get presets icon presets/platform_rail.png
- 00007.753 E: Failed to locate image 'styles/standard/transport/ticket-machine.png'
- 00007.754 W:  Food vending machine: Could not get presets icon styles/standard/transport/ticket-machine.png

Attachments (3)

2021-08-31_13H58mn14s_Haussmann.zip (343.6 KB ) - added by StephaneP 4 years ago.
.pos and .gpx files
21462.patch (3.3 KB ) - added by marcello@… 4 years ago.
patch
21462-synchronized.patch (765 bytes ) - added by marcello@… 4 years ago.
patch for excessive synchronization in preferences

Download all attachments as: .zip

Change History (23)

by StephaneP, 4 years ago

.pos and .gpx files

comment:1 by Don-vip, 4 years ago

Milestone: 21.10
Owner: changed from team to Don-vip
Status: newassigned

comment:2 by Don-vip, 4 years ago

Keywords: deadlock added

Deadlock:

Thread [main-worker-0] (Suspended)	
	owns: org.openstreetmap.josm.data.Preferences  (id=75)	
	waiting for: org.openstreetmap.josm.gui.layer.MainLayerManager  (id=76)	
	org.openstreetmap.josm.gui.layer.MainLayerManager.getActiveData() line: 410	
	org.openstreetmap.josm.gui.dialogs.properties.PropertiesDialog.preferenceChanged(org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent) line: 775	
	org.openstreetmap.josm.data.Preferences.lambda$2(org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent, org.openstreetmap.josm.spi.preferences.PreferenceChangedListener) line: 306	
	org.openstreetmap.josm.data.Preferences$$Lambda$935.0x0000000801118c50.fire(java.lang.Object) line: not available	
	org.openstreetmap.josm.tools.ListenerList$TracingListenerList<T>(org.openstreetmap.josm.tools.ListenerList<T>).fireEvent(org.openstreetmap.josm.tools.ListenerList.EventFirerer<T>) line: 155	
	org.openstreetmap.josm.data.Preferences.firePreferenceChanged(java.lang.String, org.openstreetmap.josm.spi.preferences.Setting<?>, org.openstreetmap.josm.spi.preferences.Setting<?>) line: 306	
	org.openstreetmap.josm.data.Preferences.putSetting(java.lang.String, org.openstreetmap.josm.spi.preferences.Setting<?>) line: 720	
	org.openstreetmap.josm.data.Preferences(org.openstreetmap.josm.spi.preferences.AbstractPreferences).putList(java.lang.String, java.util.List<java.lang.String>) line: 107	
	org.openstreetmap.josm.data.PreferencesUtils.putListBounded(org.openstreetmap.josm.spi.preferences.IPreferences, java.lang.String, int, java.util.List<java.lang.String>) line: 359	
	org.openstreetmap.josm.actions.OpenFileAction$OpenFileTask.realRun() line: 368	
	org.openstreetmap.josm.actions.OpenFileAction$OpenFileTask(org.openstreetmap.josm.gui.PleaseWaitRunnable).doRealRun() line: 94	
	org.openstreetmap.josm.actions.OpenFileAction$OpenFileTask(org.openstreetmap.josm.gui.PleaseWaitRunnable).run() line: 142	
	java.util.concurrent.Executors$RunnableAdapter<T>.call() line: 515	
	java.util.concurrent.FutureTask<V>.run() line: 264	
	org.openstreetmap.josm.gui.progress.swing.ProgressMonitorExecutor(java.util.concurrent.ThreadPoolExecutor).runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) line: 1130	
	java.util.concurrent.ThreadPoolExecutor$Worker.run() line: 630	
	java.lang.Thread.run() line: 831	
Thread [AWT-EventQueue-0] (Suspended)	
	owns: org.openstreetmap.josm.gui.layer.MainLayerManager  (id=76)
	waiting for: org.openstreetmap.josm.data.Preferences  (id=75)
	org.openstreetmap.josm.data.Preferences(org.openstreetmap.josm.spi.preferences.AbstractPreferences).get(java.lang.String, java.lang.String) line: 22
	org.openstreetmap.josm.io.OsmApi.getServerUrlFromPref() line: 137
	org.openstreetmap.josm.io.OsmApi.getOsmApi() line: 146
	org.openstreetmap.josm.data.imagery.ImageryInfo(org.openstreetmap.josm.data.sources.SourceInfo<T,U,V,W>).isBlacklisted() line: 720
	org.openstreetmap.josm.actions.AddImageryLayerAction.updateEnabledState() line: 321
	org.openstreetmap.josm.actions.JosmAction$ActiveLayerChangeAdapter.activeOrEditLayerChanged(org.openstreetmap.josm.gui.layer.MainLayerManager$ActiveLayerChangeEvent) line: 472
	org.openstreetmap.josm.gui.layer.MainLayerManager.fireActiveLayerChange(org.openstreetmap.josm.gui.layer.MainLayerManager$ActiveLayerChangeEvent) line: 271
	org.openstreetmap.josm.gui.layer.MainLayerManager.setActiveLayer(org.openstreetmap.josm.gui.layer.Layer, boolean) line: 264
	org.openstreetmap.josm.gui.layer.MainLayerManager.realSetActiveLayer(org.openstreetmap.josm.gui.layer.Layer) line: 248
	org.openstreetmap.josm.gui.layer.MainLayerManager.lambda$1(org.openstreetmap.josm.gui.layer.Layer) line: 241
	org.openstreetmap.josm.gui.layer.MainLayerManager$$Lambda$1070.0x0000000801200000.run() line: not available
	org.openstreetmap.josm.gui.util.GuiHelper.runInEDTAndWaitWithException(java.lang.Runnable) line: 246
	org.openstreetmap.josm.gui.layer.MainLayerManager.setActiveLayer(org.openstreetmap.josm.gui.layer.Layer) line: 241
	org.openstreetmap.josm.gui.io.importexport.GpxImporter.lambda$0(org.openstreetmap.josm.gui.io.importexport.GpxImporter$GpxImporterData) line: 150
...
	java.awt.EventDispatchThread.run() line: 90	
Last edited 4 years ago by Don-vip (previous) (diff)

comment:3 by Don-vip, 4 years ago

Priority: normalmajor

comment:4 by Don-vip, 4 years ago

Keywords: regression added
Owner: changed from Don-vip to marcello@…
Status: assignednew

@marcello can you please take a look? The deadlock occurs since r18276.

by marcello@…, 4 years ago

Attachment: 21462.patch added

patch

comment:5 by skyper, 4 years ago

#21473 describes a similar problem by loading gpx files, one after the other.

Last edited 4 years ago by skyper (previous) (diff)

comment:6 by marcello@…, 4 years ago

The problem surfaces when you change preferences, like updating the recent files list, from a non-EDT thread, while holding locks.

Blame josm.data.Preferences.putSetting() that holds a lock on Preferences while firing preferenceChanged. Don't be fooled by the comment: the method itself is synchronized.

by marcello@…, 4 years ago

Attachment: 21462-synchronized.patch added

patch for excessive synchronization in preferences

comment:7 by GerdP, 4 years ago

Could #21452 be a duplicate?

comment:8 by marcello@…, 4 years ago

Yes, #21452 is probably caused by excessive synchronization too.

comment:9 by Don-vip, 4 years ago

Summary: Can't import a gpx/pos file after a .pos importDeadlock - Can't import a gpx/pos file after a .pos import

comment:10 by Don-vip, 4 years ago

Ticket #21473 has been marked as a duplicate of this ticket.

in reply to:  6 comment:11 by Don-vip, 4 years ago

Replying to marcello@…:

The problem surfaces when you change preferences, like updating the recent files list, from a non-EDT thread, while holding locks.

Blame josm.data.Preferences.putSetting() that holds a lock on Preferences while firing preferenceChanged. Don't be fooled by the comment: the method itself is synchronized.

Thanks! you can blame me, r17541 was the commit introducing the bug.

comment:12 by Don-vip, 4 years ago

Resolution: fixed
Status: newclosed

In 18292/josm:

fix #21462 - fix excessive synchronization in preferences introduced in r17541 (patch by marcello)

comment:13 by Don-vip, 4 years ago

Ticket #21452 has been marked as a duplicate of this ticket.

comment:14 by Don-vip, 4 years ago

Ticket #21457 has been marked as a duplicate of this ticket.

comment:15 by Don-vip, 4 years ago

It seems the fix is not complete yet, looking at #21452 being reopened with this tread blocked:

"bing-attribution-loader" #137 prio=6 os_prio=0 cpu=69,77ms elapsed=507,04s tid=0x00007fb514d95ff0 nid=0xd906 waiting for monitor entry  [0x00007fb42ae79000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at java.awt.Container.removeAll(java.desktop@17/Container.java:1316)
        - waiting to lock <0x0000000580ae5f00> (a java.awt.Component$AWTTreeLock)
        at org.openstreetmap.josm.gui.dialogs.properties.PresetListPanel.updatePresets(PresetListPanel.java:69)
        at org.openstreetmap.josm.gui.dialogs.properties.PropertiesDialog.selectionChanged(PropertiesDialog.java:713)
        at org.openstreetmap.josm.gui.dialogs.properties.PropertiesDialog.updateSelection(PropertiesDialog.java:582)
        at org.openstreetmap.josm.gui.dialogs.properties.PropertiesDialog.preferenceChanged(PropertiesDialog.java:776)
        at org.openstreetmap.josm.data.Preferences.lambda$firePreferenceChanged$2(Preferences.java:306)
        at org.openstreetmap.josm.data.Preferences$$Lambda$82/0x0000000800cc55f8.fire(Unknown Source)
        at org.openstreetmap.josm.tools.ListenerList.fireEvent(ListenerList.java:155)
        at org.openstreetmap.josm.data.Preferences.firePreferenceChanged(Preferences.java:306)
        at org.openstreetmap.josm.data.Preferences.putSetting(Preferences.java:720)
        at org.openstreetmap.josm.spi.preferences.AbstractPreferences.put(AbstractPreferences.java:27)
        at org.openstreetmap.josm.spi.preferences.AbstractPreferences.putInt(AbstractPreferences.java:57)
        at org.openstreetmap.josm.io.CacheCustomContent.updateForce(CacheCustomContent.java:133)
        at org.openstreetmap.josm.io.CacheCustomContent.updateForceString(CacheCustomContent.java:143)
        at org.openstreetmap.josm.io.CacheCustomContent.updateIfRequiredString(CacheCustomContent.java:121)
        at org.openstreetmap.josm.data.imagery.CachedAttributionBingAerialTileSource.lambda$getAttributionLoaderCallable$0(CachedAttributionBingAerialTileSource.java:82)
        at org.openstreetmap.josm.data.imagery.CachedAttributionBingAerialTileSource$$Lambda$1234/0x0000000801295bf8.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(java.base@17/FutureTask.java:264)
        at java.lang.Thread.run(java.base@17/Thread.java:833)

comment:16 by GerdP, 4 years ago

@Vincent: Marcello attached two patches, you only committed one. Intended?

comment:17 by marcello@…, 4 years ago

Yes, apply both patches please, and lets see if it works then.

comment:18 by anonymous, 4 years ago

Yes, apply both patches please, and lets see if it works then.

Looks good! I applied this patch and it fixed #21452. :-)

comment:19 by Don-vip, 4 years ago

Didn't see the first patch, sorry!

comment:20 by Don-vip, 4 years ago

In 18293/josm:

fix #21452 - fix #21462 - fix deadlock (patch by marcello)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain marcello@….
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.