Modify

Opened 5 months ago

Closed 5 months ago

#23367 closed defect (fixed)

Softlock when zooming out quickly with OSMUK cadastral parcels enabled

Reported by: robertjwest2002@… Owned by: team
Priority: normal Milestone: 23.12
Component: Core imagery Version:
Keywords: template_report Cc:

Description

What steps will reproduce the problem?

  1. Download a small area
  2. Enable OSMUK Cadastral Parcels
  3. Zoom out quickly with the scroll wheel or the View: Zoom to layer hotkey

What is the expected result?

Zooms out without softlocking

What happens instead?

josm softlocks; no buttons or controls work. Windows does not identify the program as 'not responding'.
Unsaved edits are lost if force closing the program with task manager. When I left it running for 30 minutes and a blank error message appeared, I was able to restore the edited data layer next time.

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

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2023-12-07 13:35:12 +0100 (Thu, 07 Dec 2023)
Revision:18907
Build-Date:2023-12-07 16:38:49
URL:https://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (18907 en_GB) Windows 10 64-Bit
OS Build number: Windows 10 Home 2009 (19045)
Memory Usage: 320 MB / 8176 MB (94 MB allocated, but free)
Java version: 21.0.1+12-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM
Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
Screen: \Display0 2560×1440 (scaling 1.00×1.00)
Maximum Screen Size: 2560×1440
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_GB
Numbers with default locale: 1234567890 -> 1234567890
VM arguments: [-Dicedtea-web.bin.location=C:\Program Files\OpenWebStart\javaws, -Djava.util.Arrays.useLegacyMergeSort=true, --add-exports=jdk.deploy/com.sun.deploy.config=ALL-UNNAMED, --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED, --add-reads=java.naming=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.action=ALL-UNNAMED,java.desktop, --add-reads=java.base=ALL-UNNAMED,java.desktop, --add-exports=java.naming/com.sun.jndi.toolkit.url=ALL-UNNAMED,java.desktop, --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED, --add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED, --add-exports=java.desktop/sun.awt=ALL-UNNAMED,java.desktop, --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED, --add-exports=java.base/sun.security.validator=ALL-UNNAMED,java.desktop, --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED, --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED,java.desktop, --add-exports=java.base/jdk.internal.util.jar=ALL-UNNAMED,java.desktop, --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED, --add-exports=java.base/com.sun.net.ssl.internal.ssl=ALL-UNNAMED,java.desktop, --add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED, --add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web, --add-exports=java.desktop/sun.awt.X11=ALL-UNNAMED,java.desktop, --add-exports=java.desktop/sun.applet=ALL-UNNAMED,java.desktop,jdk.jsobject, --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED,java.desktop, --add-opens=java.base/java.lang=ALL-UNNAMED, --add-exports=java.base/sun.security.util=ALL-UNNAMED,java.desktop, --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED, --add-reads=java.desktop=ALL-UNNAMED,java.naming, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-exports=java.base/sun.security.x509=ALL-UNNAMED,java.desktop, --add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED, --add-exports=java.desktop/javax.jnlp=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.provider=ALL-UNNAMED,java.desktop, -Djava.security.manager=allow]

Plugins:
+ FastDraw (36126)
+ buildings_tools (36178)
+ imagery_offset_db (36126)
+ jaxb (36118)
+ jogl (1.2.3)
+ kendzi3d-resources (0.0.2)
+ log4j (36176)
+ markseen (14)
+ reltoolbox (36178)
+ reverter (36126)
+ terracer (36181)
+ turnlanes (36126)

Map paint styles:
- https://github.com/bastik/mapcss-tools/raw/osm/mapnik2mapcss/osm-results/mapnik.zip
- https://josm.openstreetmap.de/josmfile?page=Styles/iD&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Enhanced_Lane_and_Road_Attributes&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/PublicTransportV2&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Modified&zip=1

Last errors/warnings:
- 00000.220 W: extended font config - overriding 'filename.Malgun_Gothic=malgun.ttf' with 'MALGUN.TTF'
- 00000.221 W: extended font config - overriding 'filename.Myanmar_Text=mmrtext.ttf' with 'MMRTEXT.TTF'
- 00000.222 W: extended font config - overriding 'filename.Mongolian_Baiti=monbaiti.ttf' with 'MONBAITI.TTF'
- 00002.441 W: Unable to request certificate of https://roottest-g3.pkioverheid.nl
- 00002.825 W: Unable to request certificate of https://roottest-g3.pkioverheid.nl
- 00008.025 W: java.nio.file.FileSystemException: C:\Users\ROBERT~1\AppData\Local\Temp\josm_exec_powershell_7712742894256962271.txt: The process cannot access the file because it is being used by another process
- 00008.025 W: Unable to request certificate of https://grca.nat.gov.tw
- 00013.101 W: java.nio.file.FileSystemException: C:\Users\ROBERT~1\AppData\Local\Temp\josm_exec_powershell_3389053851104870917.txt: The process cannot access the file because it is being used by another process
- 00013.101 W: Unable to request certificate of https://grca.nat.gov.tw

Attachments (1)

2023-12-26_13_31_23.355-ows-stage2.log (134.3 KB ) - added by robertjwest2002@… 5 months ago.
Log

Download all attachments as: .zip

Change History (5)

by robertjwest2002@…, 5 months ago

Log

comment:1 by taylor.smock, 5 months ago

Component: CoreCore imagery
Milestone: 23.12

This appears to be due to what is effectively an infinite stream. I'm going to have to debug this a bit to figure out the "best" way to go.
It is effectively a stream of tile positions (0, 0) -> (262143, 262143) at zoom 18, for a total of 68,718,952,449 (68 billion) positions to iterate through. This takes quite a bit of time. Please note that the 262143 were just the first values that I saw exhibit this problem. They changed in subsequent runs.

Now, the reason why this happens is due to an integer overflow problem; the maximum integer (positive) in Java is 2_147_483_647 (2 billion). 68 billion is a _bit_ bigger than 2 billion. When this happens, we have undefined behavior.

I'm strongly inclined to make the modification in JMapViewer instead of JOSM (Math.multiplyExact) and document the ArithmeticException. Alternatively, I can make the change in JOSM and check to see if the value is negative. Having a "too big" number isn't a big issue, since we compare it against the tile cache, which will be _much_ less than 2 billion.

I was able to reliably reproduce, and I suspect I can reproduce with any imagery source that has a min zoom of 18 or higher.

A fairly minimal patch to JOSM would be

  • core/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java

    diff --git a/core/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java b/core/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
    a b  
    12631263        }
    12641264
    12651265        private boolean tooLarge() {
    1266             return tileCache == null || size() > tileCache.getCacheSize();
     1266            return tileCache == null || size() > tileCache.getCacheSize() || size() < 0;
    12671267        }
    12681268
    12691269        /**

I don't like this since there are other locations where size() is called.

comment:2 by taylor.smock, 5 months ago

In 36198/osm:

See #23367: Give some indication when an integer overflow occurs

In this case, we are throwing an ArithmeticException when an overflow occurs.

comment:3 by taylor.smock, 5 months ago

In 36199/osm:

Release v2.19: See #23367: Give some indication when an integer overflow occurs in TileRange#size

comment:4 by taylor.smock, 5 months ago

Resolution: fixed
Status: newclosed

In 18926/josm:

Fix #23367: Don't try to load too many tiles

In this case, we are catching an ArithmeticException when an integer overflow occurs.

Additionally, fix some lint issues and update some dependencies:

  • org.openstreetmap.jmapviewer:jmapviewer: 2.18 -> 2.19
  • ch.poole:OpeningHoursParser: 0.27.1 -> 0.28.0
  • nl.jqno.equalsverifier:equalsverifier: 3.15.4 -> 3.15.5
  • com.google.errorprone:error_prone_core: 2.23.0 -> 2.24.0

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
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.