#24893 closed defect (fixed)
[Patch] Cache for background layer Esri World Imagery needs manual flush
| Reported by: | GerdP | Owned by: | GerdP |
|---|---|---|---|
| Priority: | normal | Milestone: | 26.12 |
| Component: | Core imagery | Version: | |
| Keywords: | template_report | Cc: |
Description
What steps will reproduce the problem?
- Work for a while with Esri World Imagery background layer (and other layers)
What is the expected result?
Background images are loaded and rendered
What happens instead?
From time to time the download (or rendering) of ESRI images stops and a hourglass is rendered instead. I can wait for minutes, this will not change. When I use the "Flush tile cache" button everything is loaded within a few seconds.
Please provide any additional information below. Attach a screenshot if possible.
Revision:19621 Is-Local-Build:true Build-Date:2026-09-08 15:57:48 Identification: JOSM/1.5 (19621 SVN en) Windows 11 64-Bit OS Build number: Windows 10 Pro 25H2 (26200) Memory Usage: 4580 MB / 6144 MB (675 MB allocated, but free) Java version: 21.0.2+13-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel Screen: \Display0 1920x1080x32bpp@60Hz (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_DE Numbers with default locale: 1234567890 -> 1234567890 VM arguments: [-Djpackage.app-version=1.5.19039, --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.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=%UserProfile%\AppData\Local\JOSM\JOSM HWConsole.exe] Dataset consistency test: No problems found Plugins: + OpeningHoursEditor (36493) + apache-commons (36483) + buildings_tools (36503) + comfort0 (36483) + ejml (36483) + geotools (36483) + jackson (36502) + jaxb (36483) + jts (36483) + o5m (36493) + opendata (36503) + pbf (36493) + photo_geotagging (36503) + poly (36483) + reverter (36503) + terracer (36503) + undelete (36503) + utilsplugin2 (36503) Tagging presets: + c:\josm\core\resources\data\defaultpresets.xml Map paint styles: - c:\josm\core\resources\styles\standard\elemstyles.mapcss Validator rules: + d:\java_tools\JOSM\mygeometry.mapcss + https://josm.openstreetmap.de/josmfile?page=Rules/GermanySpecific&zip=1 + c:\josm\core\resources\data\validator\combinations.mapcss + c:\josm\core\resources\data\validator\geometry.mapcss Last errors/warnings: - 159176.756 W: Not downloading all tiles because there are more than 40 tiles on an axis! - 159176.793 W: Not downloading all tiles because there are more than 40 tiles on an axis! - 159176.850 W: Not downloading all tiles because there are more than 40 tiles on an axis! - 159176.887 W: Not downloading all tiles because there are more than 40 tiles on an axis! - 159177.257 W: Not downloading all tiles because there are more than 40 tiles on an axis! - 159177.851 W: Not downloading all tiles because there are more than 40 tiles on an axis! - 159178.490 W: Not downloading all tiles because there are more than 40 tiles on an axis! - 159179.049 W: Not downloading all tiles because there are more than 40 tiles on an axis! - 159179.187 W: Not downloading all tiles because there are more than 40 tiles on an axis! - 159354.690 W: java.net.SocketTimeoutException: Read timed out. Cause: java.net.SocketTimeoutException: Read timed out
Attachments (7)
Change History (29)
comment:1 by , 3 months ago
| Component: | Core → Core imagery |
|---|
comment:2 by , 8 days ago
I tried to reproduce this with Esri World Imagery and three other tile layers, using HTTP/1.1 and HTTP/2, without success. Occasional read timeouts (30 s) end cleanly: the tile is marked as an error and is not cached, so they don't explain tiles that stay loading. Next time it happens, before flushing, could you capture a thread dump (jstack <pid>) and the log of a session started with --debug? Also note the URL of a stuck tile (right-click "Show tile info"). The dump should show whether the loader threads are idle or blocked, and the debug log whether a job was ever submitted for the stuck tile.
L/
comment:3 by , 8 days ago
OK, will do. I guess it is my special way of using multiple background layers while mapping building outlines. I switch between the differnt layers very frequently.
comment:4 by , 6 days ago
I've now mapped several hours with these settings and didn't see the problem. So, either the problem was solved or the debug settings have an influence or the pan-reuse-v2.patch from #24842 is part of the solution. I hate those problems which simply disappear without a known reason.
comment:5 by , 6 days ago
Thanks for testing. --debug changes the timing of the tile loader threads quite a bit, so it can hide a timing-dependent problem. Maybe go back to your normal settings. If the hourglass comes back, a jstack <pid> taken before flushing is enough; it doesn't need the debug flag. If it doesn't come back for a while, I'd close this as worksforme.
comment:6 by , 5 days ago
| Resolution: | → irreproducible |
|---|---|
| Status: | new → closed |
I cannot reproduce. Will reopen this ticket if it happens again.
comment:7 by , 4 days ago
So, it happened again. Difference: I didn't log the output to file. The attaced log file contains what windows copies from the console window into a file using the export to file option.
I tried two or three and I think the missing tiles are not reported in the log.
Hope you get an idea what's wrong.
comment:8 by , 4 days ago
| Resolution: | irreproducible |
|---|---|
| Status: | closed → reopened |
Thanks, will investigate.
comment:9 by , 4 days ago
| Owner: | changed from to |
|---|---|
| Status: | reopened → new |
comment:10 by , 4 days ago
Seems my last comment got lost. I noticed that I use a different JRE when I start JOSM via JOSM HWConsole.exe. I was not able to reproduce with
openjdk version "21.0.8" 2025-07-15 LTS OpenJDK Runtime Environment Temurin-21.0.8+9 (build 21.0.8+9-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.8+9 (build 21.0.8+9-LTS, mixed mode, sharing)
So, I think I should create a backup of the existing installation and try to update using the windows installer.
comment:11 by , 3 days ago
Found it, thanks. The hourglass tile is Esri's "Map data not yet available" placeholder, which JOSM recognises through the no-tile-checksum and caches as "no tile at this zoom level". Once that cache entry expires (one day for Esri), JOSM revalidates it and gets a 304. The 304 handling replaces the cache attributes with those parsed from the response and drops the no-tile marker. The tile then finishes as "loaded" without an image, so it keeps the hourglass it starts with. Your log shows exactly that: 21/684749/1097068 got a 304 at 10:01:23, while the "missing" tile next to it got a fresh 200 and is shown correctly. Flushing works because it forces a fresh 200. Patch to follow.
by , 3 days ago
| Attachment: | no-tile-304.patch added |
|---|
comment:12 by , 3 days ago
Attached is a patch against r19703.
When the server confirms a cached object (a 304, or a HEAD request for hosts which don't send 304s), JCSCachedTileLoaderJob replaced the cache attributes with those parsed from that response. A no-tile entry is cached empty and recognised only by its noTileAtZoom marker, which comes from the response that delivered it (no-tile-header / no-tile-checksum) and is not repeated by a 304. With the marker gone, TMSCachedTileLoaderJob.loadingFinished() no longer treats the entry as a no-tile, tryLoadTileImage() skips the empty content, and the tile finishes as "loaded" with the hourglass image every Tile starts with. Since the entry is then "valid" again, it stays like that until the cache is flushed.
The patch keeps the marker in both places, through a new updateAttributes() which they now share.
Unit test TMSCachedTileLoaderJobTest.testNoTileAtZoomKeptOn304: an expired no-tile entry confirmed by a 304 stays a no-tile, and the tile does not show the hourglass. It fails without the patch, on both counts. All tests in org.openstreetmap.josm.data.cache and org.openstreetmap.josm.data.imagery pass; checkstyle and PMD are clean.
Suggested ways to test within JOSM: map as usual, go back to areas viewed at least a day earlier, at zoom levels where Esri has no imagery (the "Map data not yet available" placeholder; z21 in this case). With the patch, those tiles should show the lower zoom level instead of an hourglass. To speed testing up, if you want to also first recreate issue, then in advanced parameters you could set imagery.generic.maximum_expires to 3600000 (1 hour).
comment:13 by , 3 days ago
| Owner: | changed from to |
|---|
comment:14 by , 3 days ago
Sounds good. I'll try to reproduce with the new JRE and imagery.generic.maximum_expires set to 1 hour without and with the patch.
comment:15 by , 3 days ago
| Milestone: | → 26.12 |
|---|---|
| Summary: | Cache for background layer Esri World Imagery needs manual flush → [Patch] Cache for background layer Esri World Imagery needs manual flush |
comment:16 by , 3 days ago
OK, so far I was able to reproduce the problem with newly installed JRE (Java 25). Now trying with the patch...
follow-up: 20 comment:18 by , 44 hours ago
Ah, sorry, one remark about the unit test. The patch modifies TMSCachedTileLoaderJobTest. Shouldn't it be JCSCachedTileLoaderJobTest?
comment:20 by , 19 hours ago
Replying to GerdP:
Shouldn't it be
JCSCachedTileLoaderJobTest?
Good point. Attached no-tile-304-v2.patch adds JCSCachedTileLoaderJobTest.testNoTileAtZoomKeptOn304: an expired entry marked as no-tile is confirmed by a 304, and the marker must still be set, both in the attributes passed to the listener and in the cache. It fails without the fix.
I kept the test in TMSCachedTileLoaderJobTest as well, because it covers what you saw: the no-tile handling and the hourglass are in TMSCachedTileLoaderJob, and only that test checks that the tile doesn't end up showing the hourglass.
The source change is unchanged from the first patch.
L/
by , 19 hours ago
| Attachment: | no-tile-304-v2.patch added |
|---|



I remember similar issues with Bing. I guess that the initial download failed and either a retry is not executed or the connection is not properly reset for it.