Modify

Opened 13 months ago

Closed 13 months ago

Last modified 13 months ago

#16193 closed defect (fixed)

IAE: "Parameter 'cache' must not be null" opening a saved session file

Reported by: mpasha Owned by: mpasha
Priority: normal Milestone: 18.04
Component: Core Version: latest
Keywords: template_report cache Cc: wiktorn

Description (last modified by wiktorn)

URL:https://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2018-04-15 23:58:36 +0200 (Sun, 15 Apr 2018)
Build-Date:2018-04-16 01:32:11
Revision:13640
Relative:URL: ^/trunk

Identification: JOSM/1.5 (13640 ru) Windows 10 64-Bit
OS Build number: Windows 10 Enterprise 2016 LTSB 1607 (14393)
Memory Usage: 240 MB / 989 MB (75 MB allocated, but free)
Java version: 1.8.0_131-b11, Oracle Corporation, Java HotSpot(TM) Client VM
Screen: \Display0 1366x768
Maximum Screen Size: 1366x768
VM arguments: [-Djosm.home=<josm.pref>]

Plugins:
+ BuildingGeneralization (23)
+ DirectDownload (34109)
+ DirectUpload (34109)
+ FastDraw (34109)
+ HouseNumberTaggingTool (34109)
+ Mapillary (v1.5.10)
+ OpeningHoursEditor (34095)
+ apache-commons (34109)
+ apache-http (34109)
+ buildings_tools (34109)
+ continuosDownload (68)
+ contourmerge (1032)
+ ejml (34126)
+ geotools (34125)
+ gson (34038)
+ imagery_offset_db (34109)
+ jogl (1.1.0)
+ jts (34038)
+ log4j (34038)
+ merge-overlap (34109)
+ namemanager (34109)
+ osm-obj-info (1509723997)
+ photoadjust (34109)
+ reltoolbox (34130)
+ tag2link (34109)
+ tageditor (34109)
+ terracer (34109)
+ utilsplugin2 (34109)

Tagging presets:
+ https://josm.openstreetmap.de/josmfile?page=Presets/NewTags&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Presets/Towers&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Presets/Quick-stops&zip=1
+ https://raw.githubusercontent.com/yopaseopor/traffic_signs_preset_JOSM/master/UA.zip
+ https://josm.openstreetmap.de/josmfile?page=Presets/Manholes&zip=1

Map paint styles:
- https://github.com/GlassOceanos/indoor-JOSM-style/archive/master.zip
+ https://pasharm.github.io/New_basic_style_for_JOSM/New_basic_style.mapcss
- D:\Programs\JOSM_Portable\Map Styles\Test\elemstyles standart JOSM.mapcss
- D:\GitHub\New_basic_style_for_JOSM\New_basic_style.mapcss
- D:\GitHub\Ones test style JOSM\Ones test.mapcss
- D:\GitHub\New_basic_style_for_JOSM\New_basic_style - до reformat code.mapcss

Validator rules:
- <josm.pref>\validator\indoorhelper.validator.mapcss

Last errors/warnings:
- W: Already here java.net.UnknownHostException: pasharm.github.io
- E: Не удалось найти изображение «https://pasharm.github.io/New_basic_style_for_JOSM/icon/farmland1.png»
- W: java.net.UnknownHostException: pasharm.github.io
- W: Already here java.net.UnknownHostException: pasharm.github.io
- E: Не удалось найти изображение «https://pasharm.github.io/New_basic_style_for_JOSM/icon/farmland1.png»
- W: java.net.UnknownHostException: api.openstreetmap.org
- E: java.net.UnknownHostException: api.openstreetmap.org
- W: org.openstreetmap.josm.io.OsmTransferException: Не удается соединиться с сервером OSM. Пожалуйста, проверьте Ваше интернет-соединение.. Причина: java.net.UnknownHostException: api.openstreetmap.org
- W: java.io.IOException: Access denied
- E: Handled by bug report queue: java.lang.IllegalArgumentException: Parameter 'cache' must not be null


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

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: AWT-EventQueue-0 (17) of main
java.lang.IllegalArgumentException: Parameter 'cache' must not be null
	at org.openstreetmap.josm.tools.CheckParameterUtil.ensureParameterNotNull(CheckParameterUtil.java:69)
	at org.openstreetmap.josm.data.imagery.CachedTileLoaderFactory.<init>(CachedTileLoaderFactory.java:40)
	at org.openstreetmap.josm.gui.layer.AbstractCachedTileSourceLayer.<init>(AbstractCachedTileSourceLayer.java:63)
	at org.openstreetmap.josm.gui.layer.TMSLayer.<init>(TMSLayer.java:55)
	at org.openstreetmap.josm.gui.layer.ImageryLayer.create(ImageryLayer.java:204)
	at org.openstreetmap.josm.io.session.ImagerySessionImporter.load(ImagerySessionImporter.java:46)
	at org.openstreetmap.josm.io.session.SessionReader.parseJos(SessionReader.java:562)
	at org.openstreetmap.josm.io.session.SessionReader.loadSession(SessionReader.java:744)
	at org.openstreetmap.josm.io.session.SessionReader.loadSession(SessionReader.java:704)
	at org.openstreetmap.josm.actions.SessionLoadAction$Loader.realRun(SessionLoadAction.java:180)
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.doRealRun(PleaseWaitRunnable.java:95)
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.run(PleaseWaitRunnable.java:143)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)

Attachments (1)

1111.jos (12.2 KB) - added by anonymous 13 months ago.

Download all attachments as: .zip

Change History (15)

Changed 13 months ago by anonymous

Attachment: 1111.jos added

comment:1 Changed 13 months ago by Don-vip

Cc: wiktorn added
Keywords: cache added

Wiktor can you please take a look to this one? :)

comment:2 Changed 13 months ago by wiktorn

Sure

comment:3 Changed 13 months ago by wiktorn

Description: modified (diff)

comment:4 Changed 13 months ago by wiktorn

Owner: changed from team to mpasha
Status: newneedinfo

It looks like JOSM doesn't have access to the cache directory that you set in Imagery Preferences / Settings.

Can you share some details about this folder?

comment:5 Changed 13 months ago by wiktorn

Please, share also session file that generates the problem. Although I revoked myself rights to cache folder I can't reproduce the problem

comment:6 Changed 13 months ago by wiktorn

@Don-vip:

In following code:

        if (cachePath != null && cacheDirLock != null ) {
            IDiskCacheAttributes diskAttributes = getDiskCacheAttributes(maxDiskObjects, cachePath, cacheName);
            try {
                if (cc.getAuxCaches().length == 0) {
                    cc.setAuxCaches(new AuxiliaryCache[]{DISK_CACHE_FACTORY.createCache(
                            diskAttributes, cacheManager, null, new StandardSerializer())});
                }
            } catch (IOException e) {
                throw e;
            } catch (Exception e) { // NOPMD
                throw new IOException(e);
            }
        }
        return new CacheAccess<>(cc);
    }

Instead of thrown IOException we could just log it and return new CacheAccess<>(cc) or return new CacheAccess<>(cacheManager.getCache(cacheName, getCacheAttributes(maxMemoryObjects))).

This has the drawback is that it will silently (apart from log message) fall back to memory only cache.

What do you think?

PS. Run out of ideas how to reproduce it though

comment:7 Changed 13 months ago by Don-vip

I'm not sure to understand the chain of errors. What kind of exception did we catch in the first place?

comment:8 Changed 13 months ago by wiktorn

My wild guess is, that we got IOException: Access Denied in getCache(). Then we tried to use null cache to instantiate TMSLayer.

comment:9 Changed 13 months ago by Don-vip

OK I think you're right for the Exception in getCache(). But I don't think it comes from the piece of code you pasted, I don't see anywhere IOException being raised, even if we catch it. This sounds more suspect to me:

    private static void initialize() throws IOException {
        /* ... */
        if (!cacheDirLockPath.exists() && !cacheDirLockPath.createNewFile()) {
            Logging.warn("Cannot create cache dir lock file");
        }
        cacheDirLock = FileChannel.open(cacheDirLockPath.toPath(), StandardOpenOption.WRITE).tryLock();

The calls createNewFile(), open(), and tryLock() can throw IOException and we don't catch them.

comment:10 Changed 13 months ago by Don-vip

As we already have a fallback:

        if (cacheDirLock == null)
            Logging.warn("Cannot lock cache directory. Will not use disk cache");

I suggest to add a try/catch above and simply log any IOException that could occur. What do you think?

comment:11 Changed 13 months ago by wiktorn

Resolution: fixed
Status: needinfoclosed

In 13643/josm:

In case of any IOExceptions when creating disk cache return memory-only cache

Closes: #16193

comment:12 in reply to:  11 Changed 13 months ago by Don-vip

Milestone: 18.04

Thanks! Can you please keep the // NOPMD? It's needed if we want to keep Exception in the catch clause.

comment:13 Changed 13 months ago by wiktorn

In 13644/josm:

Supress PMD warnings

See: #16193

comment:14 Changed 13 months ago by Don-vip

Summary: Error opening a saved session fileIAE: "Parameter 'cache' must not be null" opening a saved session file

Modify Ticket

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