Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#18534 closed defect (fixed)

[Patch] Some locations cause JOSM jnlp to freeze when opening the `Imagery` menu

Reported by: taylor.smock Owned by: team
Priority: normal Milestone: 20.01
Component: Core imagery Version: latest
Keywords: jnlp, imagery Cc:

Description (last modified by taylor.smock)

This may be Mac OS X only. Also appears to occur on Fedora 31 (there is a pop up security warning, probably related to #18390). Same symptoms (except for the spinning pinwheel of death).

The issue appears to be on source:trunk/src/org/openstreetmap/josm/tools/ImageProvider.java#L858 -- cache remains locked by another thread indefinitely.

Is there a reason why we aren't using java.util.concurrent.ConcurrentHashMap instead of java.util.HashMap? Or an actual lock object? I know I've gotten warnings from some lint tools about using synchronized (map) in the past.

Alternatively, we could just wrap it in a Collections.synchronizedMap.

Please note that I have not tested it yet -- I need to figure out how to run a jnlp from a local source. I may end up having to spin up a server for it.

Steps to reproduce:
1) Start josm.jnlp (josm-latest.jnlp works as well)
2) 'http://localhost:8111/load_and_zoom?left=-47.8898656&bottom=-15.8114964&right=-47.8875375&top=-15.8092976' is the test area
3) Open Imagery menu

Attachments (2)

18534.ConcurrentHashMap.patch (9.3 KB ) - added by taylor.smock 4 years ago.
Using a ConcurrentHashMap
18534.synchronizedMap.patch (9.3 KB ) - added by taylor.smock 4 years ago.
Using a synchronizedMap

Download all attachments as: .zip

Change History (11)

by taylor.smock, 4 years ago

Using a ConcurrentHashMap

by taylor.smock, 4 years ago

Attachment: 18534.synchronizedMap.patch added

Using a synchronizedMap

comment:1 by taylor.smock, 4 years ago

Description: modified (diff)

comment:2 by taylor.smock, 4 years ago

Well, I'm having issues with Java 8 security (whitelisting localhost url's doesn't seem to be doing anything).

I'll try again on another machine.

comment:3 by stoecker, 4 years ago

Component: AppletCore Webstart

comment:4 by taylor.smock, 4 years ago

Description: modified (diff)
Summary: [Possible Patch] Some locations cause JOSM jnlp to freeze when opening the `Imagery` menu[Patch] Some locations cause JOSM jnlp to freeze when opening the `Imagery` menu

Both patches fix the problem, tested using Fedora 31 (it also froze when opening the imagery menu).

So its pretty much up to personal preferences as to which patch is better.

josm.jnlp diff, since webstart does odd things sometimes:

  • josm.jnlp

     
    11<?xml version="1.0" encoding="UTF-8"?>
    22<!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc//DTD JNLP Descriptor 6.0//EN" "http://java.sun.com/dtd/JNLP-6.0.dtd">
    3 <jnlp spec="6.0+" codebase="https://josm.openstreetmap.de/download/" href="josm.jnlp">
     3<jnlp spec="6.0+" codebase="./" href="josm.jnlp">
    44    <information>
    55        <title>JOSM</title>
    6         <vendor>OpenStreetMap</vendor> 
    7         <homepage href="https://josm.openstreetmap.de"/> 
     6        <vendor>OpenStreetMap</vendor>
     7        <homepage href="https://josm.openstreetmap.de"/>
    88        <description>Java OpenStreetMap editor</description>
    99        <description kind="one-line">JOSM</description>
    1010        <description kind="tooltip">JOSM</description>
    1111        <icon href="https://josm.openstreetmap.de/logo.png" width="256" height="256"/>
    12         <icon href="https://josm.openstreetmap.de/logo64.png" width="64" height="64" kind="shortcut"/> 
     12        <icon href="https://josm.openstreetmap.de/logo64.png" width="64" height="64" kind="shortcut"/>
    1313        <offline-allowed/>
     14        <association mime-type="application/xml application/json" extensions="geojson osm"/>
    1415        <shortcut>
    1516            <desktop/>
    1617            <menu/>
     
    2021        <all-permissions/>
    2122    </security>
    2223    <resources>
    23         <java version="1.8+" max-heap-size="2048m" java-vm-args="--add-modules=java.scripting,java.sql --add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED --add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED --add-exports=jdk.deploy/com.sun.deploy.config=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"/>
    24         <jar href="josm-tested.jar"/>
     24        <java version="1.8+" max-heap-size="4096m" java-vm-args="--add-modules=java.scripting,java.sql --add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED --add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED --add-exports=jdk.deploy/com.sun.deploy.config=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"/>
     25        <jar href="dist/josm-custom.jar"/>
    2526        <property name="java.util.Arrays.useLegacyMergeSort" value="true"/>
    2627    </resources>
    27     <application-desc main-class="org.openstreetmap.josm.gui.MainApplication"/>
     28    <application-desc main-class="org.openstreetmap.josm.gui.MainApplication">
     29    </application-desc>
    2830</jnlp>
Last edited 4 years ago by Klumbumbus (previous) (diff)

comment:5 by stoecker, 4 years ago

Milestone: 20.01

comment:6 by Don-vip, 4 years ago

Resolution: fixed
Status: newclosed

In 15675/josm:

fix #18534 - better synchronization of image cache (patch by taylor.smock)

comment:7 by Don-vip, 4 years ago

Thanks!

comment:8 by Don-vip, 4 years ago

Ticket #18548 has been marked as a duplicate of this ticket.

comment:9 by Don-vip, 4 years ago

Component: Core WebstartCore imagery

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.