Modify

Opened 2 years ago

Last modified 2 years ago

#22721 new defect

[PATCH] JOSM crashes when loading vector tiles (MVT)

Reported by: FredrikLindseth Owned by: team
Priority: normal Milestone:
Component: Core imagery Version:
Keywords: template_report Cc:

Description (last modified by taylor.smock)

What steps will reproduce the problem?

  1. Add this imagery - https://cache.kartverket.no/test/vectortiles/landtopo/{zoom}/{x}/{y}.mvt
  2. Navigate here - ish https://www.openstreetmap.org/#map=16/60.5496/4.8250
  3. Wait for data to load and JOSM crashes

What is the expected result?

The data to be loaded (without styles)

What happens instead?

The stacktrace below

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

Revision:18622
Build-Date:2023-01-04 13:00:15

Identification: JOSM/1.5 (18622 en_GB) Mac OS X 13.1
OS Build number: macOS 13.1 (22C65)
Memory Usage: 4160 MB / 8192 MB (3168 MB allocated, but free)
Java version: 17.0.5+8-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM
Look and Feel: com.apple.laf.AquaLookAndFeel
Screen: Display 1 1728×1117 (scaling 2.00×2.00)
Maximum Screen Size: 1728×1117
Best cursor sizes: 16×16→16×16, 32×32→32×32
System property file.encoding: UTF-8
System property sun.jnu.encoding: UTF-8
Locale info: en_GB
Numbers with default locale: 1234567890 -> 1234567890
VM arguments: [-Djpackage.app-version=18622, --add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web, --add-exports=java.base/sun.security.action=ALL-UNNAMED, --add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED, --add-opens=java.base/java.lang=ALL-UNNAMED, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED, --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED, --add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED, --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED, --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED, -Djpackage.app-path=/Applications/JOSM.app/Contents/MacOS/JOSM]

Plugins:
+ wikipedia (605)

Last errors/warnings:
- 00317.445 E: java.lang.IllegalArgumentException: POLYGON cannot have zero area
- 00317.453 E: Cannot add vector data for feature Feature [geometry=[CommandInteger [type=MoveTo, parameters=[-160, 4256]], CommandInteger [type=LineTo, parameters=[0, -4416, 4416, 0, 0, 4416]], CommandInteger [type=ClosePath, parameters=[]], CommandInteger [type=MoveTo, parameters=[0, -4416]], CommandInteger [type=LineTo, parameters=[-4416, 0, 0, 0]], CommandInteger [type=ClosePath, parameters=[]]], geometryType=POLYGON, id=8757293, tags=TagMap[objtype=Hav], ] of tile Tile 19/269163/150642@Kartverket vektor [LOADING...] [loaded]: POLYGON cannot have zero area
- 00317.453 E: java.lang.IllegalArgumentException: POLYGON cannot have zero area
- 00317.467 E: Cannot add vector data for feature Feature [geometry=[CommandInteger [type=MoveTo, parameters=[-160, 4256]], CommandInteger [type=LineTo, parameters=[0, 0, 0, 0, 0, 0, 0, -4416, 4416, 0, 0, 4416]], CommandInteger [type=ClosePath, parameters=[]], CommandInteger [type=MoveTo, parameters=[-4416, -4416]], CommandInteger [type=LineTo, parameters=[0, 1564, 73, 52, 105, 82, 166, 74, 269, 176, 104, 138, 153, 242, 35, 88, 56, 135, 236, 387, 132, 322, 36, 110, 26, 94, 7, 23, 40, 60, 110, 104, 85, 170, 76, 219, 26, 111, -3, 88, 10, 69, -26, 108, -823, 0, -297, -189, -50, -21, -64, 1, -40, 13, -20, 30, -6, 46, 82, 120, 3918, 0, 0, -4416]], CommandInteger [type=ClosePath, parameters=[]], CommandInteger [type=MoveTo, parameters=[-4416, 4416]], CommandInteger [type=LineTo, parameters=[0, 0, 0, 0, 0, 0, 4416, 0, 0, 0]], CommandInteger [type=ClosePath, parameters=[]]], geometryType=POLYGON, id=8757293, tags=TagMap[objtype=Hav], ] of tile Tile 19/269170/150635@Kartverket vektor [LOADING...] [loaded]: POLYGON cannot have zero area
- 00317.467 E: java.lang.IllegalArgumentException: POLYGON cannot have zero area
- 00317.468 E: Cannot add vector data for feature Feature [geometry=[CommandInteger [type=MoveTo, parameters=[-160, -160]], CommandInteger [type=LineTo, parameters=[4416, 0, 0, 0]], CommandInteger [type=ClosePath, parameters=[]]], geometryType=POLYGON, id=8367405, tags=TagMap[objtype=Åpen fastmark], ] of tile Tile 19/269170/150635@Kartverket vektor [LOADING...] [loaded]: POLYGON cannot have zero area
- 00317.468 E: java.lang.IllegalArgumentException: POLYGON cannot have zero area
- 00317.469 E: Cannot add vector data for feature Feature [geometry=[CommandInteger [type=MoveTo, parameters=[4256, 4256]], CommandInteger [type=LineTo, parameters=[-4416, 0, 0, -863, 1391, -89, 7, 23, 40, 60, 110, 104, 85, 170, 76, 219, 26, 111, -3, 88, 10, 69, -26, 108, -823, 0, -297, -189, -50, -21, -64, 1, -40, 13, -20, 30, -6, 46, 82, 120, 3918, 0]], CommandInteger [type=ClosePath, parameters=[]], CommandInteger [type=MoveTo, parameters=[-4416, 0]], CommandInteger [type=LineTo, parameters=[0, 0, 0, 0, 0, 0, 4416, 0, 0, 0]], CommandInteger [type=ClosePath, parameters=[]]], geometryType=POLYGON, id=6766527, tags=TagMap[objtype=Havflate], ] of tile Tile 19/269170/150635@Kartverket vektor [LOADING...] [loaded]: POLYGON cannot have zero area
- 00317.469 E: java.lang.IllegalArgumentException: POLYGON cannot have zero area
- 00317.632 E: Handled by bug report queue: java.util.NoSuchElementException: area iterator out of bounds



=== REPORTED CRASH DATA ===
BugReportExceptionHandler#handleException:
No data collected.

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: MVT-downloader-20 (99)
java.util.NoSuchElementException: area iterator out of bounds
	at java.desktop/java.awt.geom.AreaIterator.currentSegment(Unknown Source)
	at org.openstreetmap.josm.data.vector.VectorDataStore.pathIteratorToObjects(VectorDataStore.java:235)
	at org.openstreetmap.josm.data.vector.VectorDataStore.areaToRelation(VectorDataStore.java:272)
	at org.openstreetmap.josm.data.vector.VectorDataStore.shapeToPrimaryFeatureObject(VectorDataStore.java:386)
	at org.openstreetmap.josm.data.vector.VectorDataStore.addFeatureData(VectorDataStore.java:333)
	at org.openstreetmap.josm.data.vector.VectorDataStore.addFeatureData(VectorDataStore.java:320)
	at org.openstreetmap.josm.data.vector.VectorDataStore.addDataTile(VectorDataStore.java:304)
	at org.openstreetmap.josm.data.imagery.vectortile.mapbox.MVTTile.getData(MVTTile.java:122)
	at org.openstreetmap.josm.data.imagery.vectortile.mapbox.MVTTile.loadImage(MVTTile.java:71)
	at org.openstreetmap.josm.data.imagery.TMSCachedTileLoaderJob.tryLoadTileImage(TMSCachedTileLoaderJob.java:328)
	at org.openstreetmap.josm.data.imagery.TMSCachedTileLoaderJob.loadingFinished(TMSCachedTileLoaderJob.java:210)
	at org.openstreetmap.josm.data.cache.JCSCachedTileLoaderJob.finishLoading(JCSCachedTileLoaderJob.java:265)
	at org.openstreetmap.josm.data.cache.JCSCachedTileLoaderJob.run(JCSCachedTileLoaderJob.java:234)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

Attachments (1)

Screenshot 2023-02-07 at 22.06.56.png (3.3 MB ) - added by FredrikLindseth 2 years ago.
Screenshot of the data in JOSM

Change History (3)

by FredrikLindseth, 2 years ago

Screenshot of the data in JOSM

comment:1 by taylor.smock, 2 years ago

Description: modified (diff)

Problem tiles:

  • 19/269163/150642
  • 19/269170/150635

comment:2 by taylor.smock, 2 years ago

Component: CoreCore imagery
Summary: JOSM crashes when loading vector tiles (MVT)[PATCH] JOSM crashes when loading vector tiles (MVT)

Something like

  • src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/MVTTile.java

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    diff --git a/src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/MVTTile.java b/src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/MVTTile.java
    a b  
    77import java.util.ArrayList;
    88import java.util.Collection;
    99import java.util.List;
     10import java.util.NoSuchElementException;
    1011import java.util.Objects;
    1112
    1213import org.openstreetmap.gui.jmapviewer.Tile;
     
    6869            this.layers = new ArrayList<>(this.layers);
    6970
    7071            this.extent = layers.stream().filter(Objects::nonNull).mapToInt(Layer::getExtent).max().orElse(Layer.DEFAULT_EXTENT);
    71             if (this.getData() != null) {
    72                 this.finishLoading();
    73                 this.listenerList.fireEvent(event -> event.finishedLoading(this));
    74                 // Ensure that we don't keep the loading image around
    75                 this.image = CLEAR_LOADED;
    76                 // Cleanup as much as possible -- layers will still exist, but only base information (like name, extent) will remain.
    77                 // Called last just in case the listeners need the layers.
    78                 this.layers.forEach(Layer::destroy);
     72            try {
     73                if (this.getData() != null) {
     74                    this.finishLoading();
     75                    this.listenerList.fireEvent(event -> event.finishedLoading(this));
     76                    // Ensure that we don't keep the loading image around
     77                    this.image = CLEAR_LOADED;
     78                    // Cleanup as much as possible -- layers will still exist, but only base information (like name, extent) will remain.
     79                    // Called last just in case the listeners need the layers.
     80                    this.layers.forEach(Layer::destroy);
     81                }
     82            } catch (IllegalArgumentException | NoSuchElementException e) {
     83                throw new IOException(e);
    7984            }
    8085        }
    8186    }

will fix the problem (as far as exceptions go). It will not load the tile, but it will give some somewhat useful output in the mapview.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to FredrikLindseth.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


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