Modify

Opened 2 weeks ago

Closed 2 weeks ago

Last modified 7 days ago

#15722 closed defect (fixed)

AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThread")

Reported by: anonymous Owned by: team
Priority: normal Milestone: 18.01
Component: Core mappaint Version:
Keywords: template_report webstart security manager thread fork join pool Cc:

Description

What steps will reproduce the problem?

What is the expected result?

What happens instead?

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

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2017-12-31 03:09:43 +0100 (Sun, 31 Dec 2017)
Revision:13265
Build-Date:2017-12-31 02:33:46
URL:http://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (13265 en) Mac OS X 10.12.6
OS Build number: Mac OS X 10.12.6 (16G29)
Memory Usage: 498 MB / 2048 MB (165 MB allocated, but free)
Java version: 9+181, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM
Screen: Display 188916758 2560x1440, Display 69974260 2048x1152
Maximum Screen Size: 2560x1440
VM arguments: [--add-modules=ALL-DEFAULT,javafx.deploy, -Djava.security.manager, -Djava.security.policy=file:<java.home>/conf/security/javaws.policy, -DtrustProxy=true, -Djnlpx.home=<java.home>, -Djava.security.manager, -Djnlpx.origFilenameArg=${HOME}/Downloads/josm.jnlp, -Djnlpx.remove=false, --add-modules=java.activation,java.se.ee, --add-exports=java.base/sun.security.util=ALL-UNNAMED, --add-exports=java.base/sun.security.x509=ALL-UNNAMED, --add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.spi=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/jdk.internal.loader=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, -Djava.util.Arrays.useLegacyMergeSort=true, -Dmacosx.jnlpx.dock.name=JOSM, -Dmacosx.jnlpx.dock.icon=${HOME}/Library/Application Support/Oracle/Java/Deployment/cache/6.0/16/47ee53d0-61451477.icns, -Djnlpx.jvm="<java.home>/bin/java", --illegal-access=deny, --add-modules=ALL-DEFAULT, --add-exports=java.base/com.sun.net.ssl.internal.ssl=jdk.deploy, --add-exports=java.base/jdk.internal.misc=jdk.deploy, --add-exports=java.base/jdk.internal.util.jar=jdk.deploy, --add-exports=java.base/sun.net.www=jdk.deploy, --add-exports=java.base/sun.net.www.protocol.file=jdk.deploy, --add-exports=java.base/sun.net.www.protocol.http=jdk.deploy, --add-exports=java.base/sun.net.www.protocol.http.ntlm=jdk.deploy, --add-exports=java.base/sun.net.www.protocol.https=jdk.deploy, --add-exports=java.base/sun.net.www.protocol.jar=jdk.deploy, --add-exports=java.base/sun.nio=jdk.deploy, --add-exports=java.base/sun.reflect.misc=jdk.deploy, --add-exports=java.base/sun.security.action=jdk.deploy, --add-exports=java.base/sun.security.pkcs=jdk.deploy, --add-exports=java.base/sun.security.provider=jdk.deploy, --add-exports=java.base/sun.security.provider.certpath=jdk.deploy, --add-exports=java.base/sun.security.rsa=jdk.deploy, --add-exports=java.base/sun.security.ssl=jdk.deploy, --add-exports=java.base/sun.security.timestamp=jdk.deploy, --add-exports=java.base/sun.security.util=jdk.deploy, --add-exports=java.base/sun.security.validator=jdk.deploy, --add-exports=java.base/sun.security.x509=jdk.deploy, --add-exports=java.base/sun.usagetracker=jdk.deploy, --add-exports=java.desktop/sun.awt=jdk.deploy, --add-exports=java.naming/com.sun.jndi.toolkit.url=jdk.deploy, --add-exports=java.base/jdk.internal.misc=jdk.javaws, --add-exports=java.desktop/com.sun.media.sound=jdk.javaws, --add-exports=java.desktop/sun.awt=jdk.javaws, --add-exports=java.desktop/sun.awt.image=jdk.javaws, --add-exports=java.base/jdk.internal.misc=jdk.plugin, --add-exports=java.base/sun.net=jdk.plugin, --add-exports=java.base/sun.net.www=jdk.plugin, --add-exports=java.base/sun.net.www.protocol.jar=jdk.plugin, --add-exports=java.base/sun.security.action=jdk.plugin, --add-exports=java.base/sun.security.util=jdk.plugin, --add-exports=java.desktop/com.sun.media.sound=jdk.plugin, --add-exports=java.desktop/java.awt.peer=jdk.plugin, --add-exports=java.desktop/sun.applet=jdk.plugin, --add-exports=java.desktop/sun.applet.resources=jdk.plugin, --add-exports=java.desktop/sun.awt=jdk.plugin, --add-exports=java.desktop/sun.awt.windows=jdk.plugin, --add-exports=java.desktop/sun.swing=jdk.plugin, --add-exports=jdk.jsobject/jdk.internal.netscape.javascript.spi=jdk.plugin, --add-exports=java.desktop/com.apple.eio=jdk.deploy, --add-exports=java.base/sun.net.www.protocol.jar=jdk.javaws, --add-exports=java.base/sun.security.util=jdk.javaws, --add-exports=java.desktop/com.apple.eio=jdk.javaws, --add-exports=java.desktop/com.apple.eawt=jdk.plugin, --add-exports=java.desktop/sun.lwawt.macosx=jdk.plugin, -Djdk.module.main=jdk.plugin]
Dataset consistency test: No problems found

Plugins:
+ DirectUpload (33882)
+ buildings_tools (33735)
+ pt_assistant (33860)
+ reverter (33865)
+ turnrestrictions (33780)
+ utilsplugin2 (33742)

Map paint styles:
- ${HOME}/Downloads/KStreet_ID_2.2.mapcss
- ${HOME}/Downloads/KStreet_ID_2.1.mapcss
- ${HOME}/Downloads/KStreet_ID_2.0.mapcss
- ${HOME}/Downloads/KStreet_ID.mapcss
- ${HOME}/Downloads/KStreet_ID (1).css
- ${HOME}/Downloads/KStreet_ID.css
- ${HOME}/Downloads/Colors.mapcss
- ${HOME}/Downloads/Kaart Styles 3.0.mapcss
+ https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1
- ${HOME}/Downloads/Kaart Styles 3.1 (1).mapcss
+ ${HOME}/Downloads/Kaart Styles 3.1 (1).mapcss

Last errors/warnings:
- W: java.io.IOException: Attribution is not loaded yet
- W: java.io.IOException: Attribution is not loaded yet
- W: java.io.IOException: Attribution is not loaded yet
- W: java.io.IOException: Attribution is not loaded yet
- W: java.io.IOException: Attribution is not loaded yet
- W: java.io.IOException: Attribution is not loaded yet
- E: Handled by bug report queue: java.lang.ExceptionInInitializerError. Cause: java.lang.ExceptionInInitializerError. Cause: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThread")
- E: Handled by bug report queue: java.lang.NoClassDefFoundError. Cause: java.lang.NoClassDefFoundError: Could not initialize class org.openstreetmap.josm.data.osm.MultipolygonBuilder
- E: Handled by bug report queue: java.lang.NoClassDefFoundError. Cause: java.lang.NoClassDefFoundError: Could not initialize class org.openstreetmap.josm.data.osm.MultipolygonBuilder
- E: Handled by bug report queue: java.lang.NoClassDefFoundError. Cause: java.lang.NoClassDefFoundError: Could not initialize class org.openstreetmap.josm.data.osm.MultipolygonBuilder


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

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: AWT-EventQueue-2 (45) of javawsApplicationThreadGroup
java.lang.NoClassDefFoundError
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.reportException(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.join(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.invoke(Unknown Source)
	at org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer.paintWithLock(StyledMapRenderer.java:1602)
	at org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer.render(StyledMapRenderer.java:1574)
	at org.openstreetmap.josm.gui.layer.OsmDataLayer.paint(OsmDataLayer.java:474)
	at org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable$CompatibilityModeLayerPainter.paint(AbstractMapViewPaintable.java:27)
	at org.openstreetmap.josm.gui.MapView.paintLayer(MapView.java:470)
	at org.openstreetmap.josm.gui.MapView.drawMapContent(MapView.java:586)
	at org.openstreetmap.josm.gui.MapView.paint(MapView.java:492)
	at java.desktop/javax.swing.JComponent.paintChildren(Unknown Source)
	at java.desktop/javax.swing.JComponent.paint(Unknown Source)
	at java.desktop/javax.swing.JComponent.paintToOffscreen(Unknown Source)
	at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBufferedImpl(Unknown Source)
	at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
	at java.desktop/javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
	at java.desktop/javax.swing.RepaintManager.paint(Unknown Source)
	at java.desktop/javax.swing.JComponent._paintImmediately(Unknown Source)
	at java.desktop/javax.swing.JComponent.paintImmediately(Unknown Source)
	at java.desktop/javax.swing.RepaintManager$4.run(Unknown Source)
	at java.desktop/javax.swing.RepaintManager$4.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
	at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
	at java.desktop/javax.swing.RepaintManager.access$1200(Unknown Source)
	at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.EventQueue.access$500(Unknown Source)
	at java.desktop/java.awt.EventQueue$3.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$3.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.openstreetmap.josm.data.osm.MultipolygonBuilder
	at org.openstreetmap.josm.tools.Geometry.isPolygonInsideMultiPolygon(Geometry.java:926)
	at org.openstreetmap.josm.gui.mappaint.mapcss.Selector$ChildOrParentSelector$ContainsFinder.visit(Selector.java:305)
	at org.openstreetmap.josm.data.osm.Way.accept(Way.java:210)
	at org.openstreetmap.josm.gui.mappaint.mapcss.Selector$ChildOrParentSelector$AbstractFinder.visit(Selector.java:224)
	at org.openstreetmap.josm.gui.mappaint.mapcss.Selector$ChildOrParentSelector.matches(Selector.java:355)
	at org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource.apply(MapCSSStyleSource.java:664)
	at org.openstreetmap.josm.gui.mappaint.ElemStyles.generateStyles(ElemStyles.java:365)
	at org.openstreetmap.josm.gui.mappaint.ElemStyles.getImpl(ElemStyles.java:339)
	at org.openstreetmap.josm.gui.mappaint.ElemStyles.getStyleCacheWithRange(ElemStyles.java:148)
	at org.openstreetmap.josm.gui.mappaint.ElemStyles.get(ElemStyles.java:127)
	at org.openstreetmap.josm.data.osm.visitor.paint.ComputeStyleListWorker.add(ComputeStyleListWorker.java:178)
	at org.openstreetmap.josm.data.osm.visitor.paint.ComputeStyleListWorker.visit(ComputeStyleListWorker.java:143)
	at org.openstreetmap.josm.data.osm.Relation.accept(Relation.java:180)
	at org.openstreetmap.josm.data.osm.visitor.paint.ComputeStyleListWorker.acceptDrawable(ComputeStyleListWorker.java:124)
	at org.openstreetmap.josm.data.osm.visitor.paint.ComputeStyleListWorker.computeDirectly(ComputeStyleListWorker.java:111)
	at org.openstreetmap.josm.data.osm.visitor.paint.ComputeStyleListWorker.compute(ComputeStyleListWorker.java:88)
	at org.openstreetmap.josm.data.osm.visitor.paint.ComputeStyleListWorker.compute(ComputeStyleListWorker.java:34)
	at java.base/java.util.concurrent.RecursiveTask.exec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)

Attachments (0)

Change History (16)

comment:1 Changed 2 weeks ago by cmuelle8

Please try with latest version of josm, if the problem persists try disabling plugins, try disabling map styles.

If you cannot reproduce the problem with the bare latest revision, then please re-enable map styles one-by-one, then plugins one-by-one until the problem reappears. This helps to narrow down the problem.

If the problem persists even with the bare latest revision, then you can try to find the first older revision that does not exhibit the problem.

Thanks.

comment:2 Changed 2 weeks ago by Don-vip

Summary: Bug Report v13265NoClassDefFoundError: Could not initialize class josm.data.osm.MultipolygonBuilder

comment:3 Changed 2 weeks ago by Don-vip

Owner: changed from team to anonymous
Status: newneedinfo

Can you please try to update to java 9.0.1?

comment:4 Changed 2 weeks ago by Don-vip

Keywords: java9 added

comment:5 Changed 2 weeks ago by Don-vip

Error is:

- java.lang.ExceptionInInitializerError. Cause: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThread")
- java.lang.NoClassDefFoundError: Could not initialize class org.openstreetmap.josm.data.osm.MultipolygonBuilder

comment:6 Changed 2 weeks ago by Don-vip

I don't understand.

When running from Java Web Start, we have a security manager, as per Java 9 Access Control:

Java applets and Java Web Start applications are automatically run with a SecurityManager installed. However, local applications executed via the java command are by default not run with a SecurityManager installed. In order to run local applications with a SecurityManager, either the application itself must programmatically set one via the setSecurityManager method (in the java.lang.System class), or java must be invoked with a -Djava.security.manager argument on the command line.

This is verified by the JOSM command line found in this report:

VM arguments: [...,
-Djava.security.manager,
-Djava.security.policy=file:<java.home>/conf/security/javaws.policy,
...,
-Djnlpx.home=<java.home>,
-Djava.security.manager,
-Djnlpx.origFilenameArg=${HOME}/Downloads/josm.jnlp,
-Djnlpx.remove=false,
...,
-Djdk.module.main=jdk.plugin]

The exception is thrown from this method in Utils:

    public static ForkJoinPool newForkJoinPool(String pref, final String nameFormat, final int threadPriority) {
        int noThreads = Config.getPref().getInt(pref, Runtime.getRuntime().availableProcessors());
        return new ForkJoinPool(noThreads, new ForkJoinPool.ForkJoinWorkerThreadFactory() {
            ...
        }, null, true);
    }

Indeed ForkJoinPool constructor documentation states:

Throws:

SecurityException - if a security manager exists and the caller is not permitted to modify threads because it does not hold RuntimePermission("modifyThread")

But we should have all permissions! In our jnlp we define so:

    <security>
        <all-permissions/>
    </security>

@anonymous: can you please check you see these lines in ${HOME}/Downloads/josm.jnlp ?

comment:7 Changed 2 weeks ago by Don-vip

OK I think I have a lead. We try to create a new ForkJoinPool from code running in another ForkJoinPool instance (StyledMapRenderer.THREAD_POOL).

This might not work if we have a security manager, as explained here:

if a SecurityManager is present, then the common pool uses a factory supplying threads that have no Permissions enabled.

Last edited 2 weeks ago by Don-vip (previous) (diff)

comment:8 Changed 2 weeks ago by Don-vip

Component: CoreCore mappaint
Keywords: webstart security manager thread fork join pool added; java9 removed
Milestone: 18.01
Owner: changed from anonymous to team
Status: needinfonew
Summary: NoClassDefFoundError: Could not initialize class josm.data.osm.MultipolygonBuilderAccessControlException: access denied ("java.lang.RuntimePermission" "modifyThread")

comment:9 Changed 2 weeks ago by Don-vip

Resolution: fixed
Status: newclosed

In 13273/josm:

fix #15722 - make sure that JOSM ForkJoinPool instances create threads with same permissions than JOSM

This is not the case with default JDK thread factory when JOSM is run with Java Web Start, as the presence of a security manager leads to threads created without any permission

comment:10 Changed 2 weeks ago by Klumbumbus

I don't know if this change is related, but there was no new latest version created last night. It is still r13271

comment:11 Changed 2 weeks ago by Don-vip

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

comment:12 Changed 2 weeks ago by Don-vip

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

comment:13 Changed 2 weeks ago by Don-vip

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

comment:14 Changed 2 weeks ago by Don-vip

@anonymous: please stop reporting the same issue several times. To workaround the issue you can use the macOS package instead of Web Start, until the new version is released.

comment:15 Changed 7 days ago by Don-vip

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

comment:16 Changed 7 days ago by Don-vip

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

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.

Add Comment


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

 
Note: See TracTickets for help on using tickets.