Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#13128 closed defect (fixed)

JCS WMS TileCache not used if JOSM is run offline

Reported by: cmuelle8 Owned by: wiktorn
Priority: normal Milestone: 16.07
Component: Core imagery Version: latest
Keywords: imagery wms jcs tile cache offline Cc:

Description

If there is no network connection, or if the WMS host is unavailable/unreachable,
WMS layer shows "error" tiles instead of cached tiles.

Expected behavior:

  • Only try to update cached tile, if network and host is actually available.
  • Show cached tile, if available in cache.

In addition it would be nice to have mbtiles import/export function under Settings (F12) > WMS Panel > Cache Contents. But this is just nice to have, while above is crucial, imho.

URL:http://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2016-07-10 01:08:07 +0200 (Sun, 10 Jul 2016)
Build-Date:2016-07-10 01:32:29
Revision:10523
Relative:URL: ^/trunk

Identification: JOSM/1.5 (10523 de) Linux No LSB modules are available.
Memory Usage: 518 MB / 1820 MB (126 MB allocated, but free)
Java version: 1.8.0_91-b14, Oracle Corporation, OpenJDK 64-Bit Server VM
Dataset consistency test: No problems found

Plugins:
- PicLayer (32329)
- RoadSigns (32309)
- apache-commons (32309)
- editgpx (32309)
- jogl (1.0.46)
- kendzi3d (1.0.190.1)
- kendzi3d-resources (0.0.1)
- log4j (32309)
- measurement (32324)
- openvisible (32309)
- pbf (32309)
- photo_geotagging (32326)
- photoadjust (32329)
- poly (32309)
- print (32309)
- reverter (32309)
- turnlanes (32309)
- turnrestrictions (32386)
- undelete (32309)
- utilsplugin2 (32333)
- wikipedia (32627)

Attachments (0)

Change History (15)

comment:1 Changed 5 years ago by Don-vip

Owner: changed from team to wiktorn

comment:2 Changed 5 years ago by wiktorn

I disconnected my network and I was able to see the map without a problem.

Can you tell me which Imagery Provider did you use?

Anyway - I've added MbTiles as an additional tab in preferences in MbTiles plugin. You can track this here:
https://github.com/iandees/josm-mbtiles/pull/10

comment:3 Changed 5 years ago by wiktorn

Resolution: fixed
Status: newclosed

In 10545/josm:

Use stale cache tiles if IOException occurs

  • small pretty print fixes (MemoryTileCache, TileSet)
  • increase TileCache estimate (to accomodate larger TileSet's traverses when in offline mode)
  • fix TileSet computations, sometimes it generated tileset of size 2 instead of 4 (for tiles inside the tile)

Closes: #13128

comment:5 Changed 5 years ago by wiktorn

In 10558/josm:

Do not cache IOException in JCS, they should be cached only in memory.

Caching IOException in JCS Cache leads to the situation, where errors
are cached for DEFAULT_EXPIRE_TIME which causes the error message to
stay too long on user screen.

Fix tests for JCSCachedTileLoaderJob

See: #13128

comment:6 Changed 5 years ago by cmuelle8

Confirmed working, thanks.

Seems to be just a minor glitch left,
concerning maximum size of WMS cache data file,
to reproduce please do:

  • adjust wms cache size (e.g. 10240 instead of 512) in settings
  • fill the cache, confirm the file growing >512m on disk
  • quit JOSM
  • clear configuration
  • start JOSM
  • now only a fraction (supposedly first 512m) of the cached data is used
  • file is _not_ shrunk (which is expected from a user perspective)

If settings are changed thus that wms cache size uses previous value, then after restart full cache contents are used (and reported about in stats tab).

IMHO, we should not deduct and change the default settings value, when a larger cache file exists at startup. Rather do a max(file_size_on_disk, setting_size_configured) to determine the cache size to use for the session.

In any case, shrinking the cache file on disk should only be done, if user actively decreases value in settings tab (maybe with warning prior to doing so).

Thanks again for the quick fix,
I did expect the bug to linger longer in trac..

comment:7 Changed 5 years ago by wiktorn

Resolution: fixed
Status: closedreopened

Indeed, that's something we can do. As JCS will not shrink the file anyway, we could use the whole file, if it's larger than what we have configured.

comment:8 Changed 5 years ago by wiktorn

Resolution: fixed
Status: reopenedclosed

In 10562/josm:

Use whole file if cache file size is greater than desired limit.

Closes: #13128

comment:9 Changed 5 years ago by Don-vip

Milestone: 16.07

comment:10 Changed 5 years ago by Don-vip

How does it solve the bug? maxDiskObjects is not used later in the code.

comment:11 in reply to:  10 Changed 5 years ago by cmuelle8

Replying to Don-vip:

How does it solve the bug? maxDiskObjects is not used later in the code.

Maybe the code block was meant to go before source:trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java@10562#L174 ?

Here only rev10558 was tested ok, which solved main problem of this bug.

comment:12 in reply to:  10 Changed 5 years ago by wiktorn

Resolution: fixed
Status: closedreopened

Replying to Don-vip:

How does it solve the bug? maxDiskObjects is not used later in the code.

Good catch. I'll fix this later today.

comment:13 Changed 5 years ago by Don-vip

Findbugs catched it :)

comment:14 Changed 5 years ago by wiktorn

Resolution: fixed
Status: reopenedclosed

In 10652/josm:

Fix not using the calculated disk cache size.

Add unit tests for #13128 - using existing file size if greater than desired cache size.

Closes #13128

comment:15 Changed 5 years ago by Don-vip

In 10654/josm:

see #13128 - checkstyle

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain wiktorn.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.