Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#21360 closed defect (wontfix)

Out of memory completely stalls program instead of displaying a message

Reported by: skyper Owned by: team
Priority: normal Milestone:
Component: Core Version: latest
Keywords: template_report out of memory Cc:

Description (last modified by skyper)

What steps will reproduce the problem?

  1. Start JOSM with little memory
  2. Load several times two different versions of locally, complete defaultpresets.xml
  3. Run out of memory for an unknown reason as it worked a few times while loading the local files


What is the expected result?

A nice message about "Out of memory" in a new dialog and JOSM continues to work.

What happens instead?

No user information and JOSM stalls completely.

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

Think, this happened to me once when loading a huge OSM data file and adding an imagery layer, too.
I have not seen the dialog about "Out of memory" for a while now, so something is broken, here.

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2021-09-15 00:16:42 +0200 (Wed, 15 Sep 2021)
Revision:18225
Build-Date:2021-09-15 01:31:02
URL:https://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (18225 en) Linux Debian GNU/Linux 11 (bullseye)
Memory Usage: 256 MB / 256 MB (59 MB allocated, but free)
Java version: 17-ea+19-Debian-1, Debian, OpenJDK 64-Bit Server VM
Look and Feel: javax.swing.plaf.metal.MetalLookAndFeel
Desktop environment: GNOME
libcommons-compress-java: libcommons-compress-java:all-1.20-1
libcommons-logging-java: libcommons-logging-java:all-1.2-2
fonts-noto: fonts-noto:all-20201225-1
VM arguments: [-Djosm.home=<josm.pref>/]
Dataset consistency test: No problems found

Plugins:
+ flatlaf (35799)
+ tagging-preset-tester (35640)

Tagging presets:
+ ${HOME}/JOSM/presets/Presets_PublicTransportGtfs-preset.xml
+ ${HOME}/JOSM/presets/Presets_LaneAttributes-preset.xml
+ ${HOME}/JOSM/presets/Presets_IsSidepath-preset.xml
+ ${HOME}/JOSM/presets/Presets_FIXME-preset.xml
+ ${HOME}/JOSM/new/resources/data/defaultpresets_18210_20530.xml

Map paint styles:
- ${HOME}/JOSM/new/resources/styles/standard/elemstyles_17814_shrub_18685.mapcss
- ${HOME}/JOSM/new/resources/styles/standard/elemstyles_17814_restriction_20833.mapcss
+ ${HOME}/JOSM/new/resources/styles/standard/elemstyles_18094_20530.mapcss
+ https://josm.openstreetmap.de/josmfile?page=Styles/IconTester&zip=1

Validator rules:
- ${HOME}/JOSM/validator/GTFS.validator.mapcss
+ ${HOME}/JOSM/new/resources/data/validator/combinations_18112_20530.mapcss
- ${HOME}/JOSM/new/resources/data/validator/unnecessary_17947_20902.mapcss
- ${HOME}/JOSM/new/resources/data/validator/numeric_17939_21068.mapcss
- ${HOME}/JOSM/validator/New_Testing.validator.mapcss
- ${HOME}/JOSM/new/resources/data/validator/multiple_18105_21192.mapcss
- ${HOME}/JOSM/new/resources/data/validator/relation_16255_destination_sign.mapcss
2021-09-21 16:00:38.863 SEVERE: Thread main-worker-0 raised java.lang.OutOfMemoryError: Java heap space


Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "AWT-XAWT"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Java2D Disposer"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "AWT-EventQueue-0"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Timer-0"
2021-09-21 16:05:18
Full thread dump OpenJDK 64-Bit Server VM (17-ea+19-Debian-1 mixed mode, sharing):

Threads class SMR info:
_java_thread_list=0x00007f86a00be7b0, length=24, elements={
0x00007f87041b6d20, 0x00007f87041b8180, 0x00007f87041be560, 0x00007f87041bf990,
0x00007f87041c0de0, 0x00007f87041c2810, 0x00007f87041c3dc0, 0x00007f87041c52b0,
0x00007f87041e4ac0, 0x00007f87041e8010, 0x00007f8704536560, 0x00007f868402c030,
0x00007f867408c340, 0x00007f8704824ff0, 0x00007f87048297f0, 0x00007f870499cd10,
0x00007f868cdcfaf0, 0x00007f8704a35c80, 0x00007f8704014870, 0x00007f8674217df0,
0x00007f86742e3a70, 0x00007f86742fc740, 0x00007f86742f9b50, 0x00007f8674301db0
}

"Reference Handler" #2 daemon prio=10 os_prio=0 cpu=39,51ms elapsed=5015,25s tid=0x00007f87041b6d20 nid=0x3a1a waiting on condition  [0x00007f86df3fe000]
   java.lang.Thread.State: RUNNABLE
	at java.lang.ref.Reference.waitForReferencePendingList(java.base@17-ea/Native Method)
	at java.lang.ref.Reference.processPendingReferences(java.base@17-ea/Reference.java:253)
	at java.lang.ref.Reference$ReferenceHandler.run(java.base@17-ea/Reference.java:215)

"Finalizer" #3 daemon prio=8 os_prio=0 cpu=2,51ms elapsed=5015,25s tid=0x00007f87041b8180 nid=0x3a1b in Object.wait()  [0x00007f86df2fd000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(java.base@17-ea/Native Method)
	- waiting on <no object reference available>
	at java.lang.ref.ReferenceQueue.remove(java.base@17-ea/ReferenceQueue.java:155)
	- locked <0x00000000f067eb58> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(java.base@17-ea/ReferenceQueue.java:176)
	at java.lang.ref.Finalizer$FinalizerThread.run(java.base@17-ea/Finalizer.java:171)

"Signal Dispatcher" #4 daemon prio=9 os_prio=0 cpu=0,21ms elapsed=5015,24s tid=0x00007f87041be560 nid=0x3a1c waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Service Thread" #5 daemon prio=9 os_prio=0 cpu=1652,52ms elapsed=5015,24s tid=0x00007f87041bf990 nid=0x3a1d runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Monitor Deflation Thread" #6 daemon prio=9 os_prio=0 cpu=317,75ms elapsed=5015,24s tid=0x00007f87041c0de0 nid=0x3a1e runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" #7 daemon prio=9 os_prio=0 cpu=87965,46ms elapsed=5015,24s tid=0x00007f87041c2810 nid=0x3a1f waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task

"C1 CompilerThread0" #9 daemon prio=9 os_prio=0 cpu=17728,99ms elapsed=5015,24s tid=0x00007f87041c3dc0 nid=0x3a20 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task

"Sweeper thread" #10 daemon prio=9 os_prio=0 cpu=955,39ms elapsed=5015,24s tid=0x00007f87041c52b0 nid=0x3a21 runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Notification Thread" #11 daemon prio=9 os_prio=0 cpu=0,19ms elapsed=5015,20s tid=0x00007f87041e4ac0 nid=0x3a22 runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Common-Cleaner" #12 daemon prio=8 os_prio=0 cpu=16,89ms elapsed=5015,17s tid=0x00007f87041e8010 nid=0x3a24 in Object.wait()  [0x00007f86de43b000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(java.base@17-ea/Native Method)
	- waiting on <no object reference available>
	at java.lang.ref.ReferenceQueue.remove(java.base@17-ea/ReferenceQueue.java:155)
	- locked <0x00000000f067ed80> (a java.lang.ref.ReferenceQueue$Lock)
	at jdk.internal.ref.CleanerImpl.run(java.base@17-ea/CleanerImpl.java:140)
	at java.lang.Thread.run(java.base@17-ea/Thread.java:831)
	at jdk.internal.misc.InnocuousThread.run(java.base@17-ea/InnocuousThread.java:161)

"main-worker-0" #20 prio=5 os_prio=0 cpu=2227,17ms elapsed=5007,90s tid=0x00007f8704536560 nid=0x3a38 waiting on condition  [0x00007f86dc2c2000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@17-ea/Native Method)
	- parking to wait for  <0x00000000f0ba42d8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.park(java.base@17-ea/LockSupport.java:341)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(java.base@17-ea/AbstractQueuedSynchronizer.java:506)
	at java.util.concurrent.ForkJoinPool.unmanagedBlock(java.base@17-ea/ForkJoinPool.java:3455)
	at java.util.concurrent.ForkJoinPool.managedBlock(java.base@17-ea/ForkJoinPool.java:3426)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(java.base@17-ea/AbstractQueuedSynchronizer.java:1623)
	at java.util.concurrent.LinkedBlockingQueue.take(java.base@17-ea/LinkedBlockingQueue.java:435)
	at java.util.concurrent.ThreadPoolExecutor.getTask(java.base@17-ea/ThreadPoolExecutor.java:1061)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@17-ea/ThreadPoolExecutor.java:1121)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@17-ea/ThreadPoolExecutor.java:635)
	at java.lang.Thread.run(java.base@17-ea/Thread.java:831)

"AWT-Shutdown" #22 prio=5 os_prio=0 cpu=2,60ms elapsed=5007,54s tid=0x00007f868402c030 nid=0x3a39 in Object.wait()  [0x00007f86dc1c1000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(java.base@17-ea/Native Method)
	- waiting on <no object reference available>
	at java.lang.Object.wait(java.base@17-ea/Object.java:338)
	at sun.awt.AWTAutoShutdown.run(java.desktop@17-ea/AWTAutoShutdown.java:291)
	- locked <0x00000000f0dbbf70> (a java.lang.Object)
	at java.lang.Thread.run(java.base@17-ea/Thread.java:831)

"TimerQueue" #23 daemon prio=5 os_prio=0 cpu=305,50ms elapsed=5006,78s tid=0x00007f867408c340 nid=0x3a3b waiting on condition  [0x00007f867fefd000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@17-ea/Native Method)
	- parking to wait for  <0x00000000f10461d8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.park(java.base@17-ea/LockSupport.java:341)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(java.base@17-ea/AbstractQueuedSynchronizer.java:506)
	at java.util.concurrent.ForkJoinPool.unmanagedBlock(java.base@17-ea/ForkJoinPool.java:3455)
	at java.util.concurrent.ForkJoinPool.managedBlock(java.base@17-ea/ForkJoinPool.java:3426)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(java.base@17-ea/AbstractQueuedSynchronizer.java:1623)
	at java.util.concurrent.DelayQueue.take(java.base@17-ea/DelayQueue.java:217)
	at javax.swing.TimerQueue.run(java.desktop@17-ea/TimerQueue.java:171)
	at java.lang.Thread.run(java.base@17-ea/Thread.java:831)

"FileSystemWatchService" #24 daemon prio=5 os_prio=0 cpu=1,63ms elapsed=5005,50s tid=0x00007f8704824ff0 nid=0x3a3d runnable  [0x00007f867fdfc000]
   java.lang.Thread.State: RUNNABLE
	at sun.nio.fs.LinuxWatchService.poll(java.base@17-ea/Native Method)
	at sun.nio.fs.LinuxWatchService$Poller.run(java.base@17-ea/LinuxWatchService.java:314)
	at java.lang.Thread.run(java.base@17-ea/Thread.java:831)

"File Watcher" #25 prio=5 os_prio=0 cpu=0,40ms elapsed=5005,47s tid=0x00007f87048297f0 nid=0x3a3e waiting on condition  [0x00007f867f3fe000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@17-ea/Native Method)
	- parking to wait for  <0x00000000f164fd58> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.park(java.base@17-ea/LockSupport.java:341)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(java.base@17-ea/AbstractQueuedSynchronizer.java:506)
	at java.util.concurrent.ForkJoinPool.unmanagedBlock(java.base@17-ea/ForkJoinPool.java:3455)
	at java.util.concurrent.ForkJoinPool.managedBlock(java.base@17-ea/ForkJoinPool.java:3426)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(java.base@17-ea/AbstractQueuedSynchronizer.java:1623)
	at java.util.concurrent.LinkedBlockingDeque.takeFirst(java.base@17-ea/LinkedBlockingDeque.java:485)
	at java.util.concurrent.LinkedBlockingDeque.take(java.base@17-ea/LinkedBlockingDeque.java:673)
	at sun.nio.fs.AbstractWatchService.take(java.base@17-ea/AbstractWatchService.java:118)
	at org.openstreetmap.josm.io.FileWatcher.processEvents(FileWatcher.java:120)
	at org.openstreetmap.josm.io.FileWatcher$$Lambda$314/0x00000008012f8a70.run(Unknown Source)
	at java.lang.Thread.run(java.base@17-ea/Thread.java:831)

"Weak reference cleaner" #26 prio=5 os_prio=0 cpu=0,27ms elapsed=5004,37s tid=0x00007f870499cd10 nid=0x3a3f in Object.wait()  [0x00007f867f2fd000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(java.base@17-ea/Native Method)
	- waiting on <0x00000000f13e5368> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(java.base@17-ea/ReferenceQueue.java:155)
	- locked <0x00000000f13e5368> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(java.base@17-ea/ReferenceQueue.java:176)
	at org.openstreetmap.josm.tools.ListenableWeakReference.clean(ListenableWeakReference.java:60)
	at org.openstreetmap.josm.tools.ListenableWeakReference$$Lambda$362/0x000000080133b3b0.run(Unknown Source)
	at java.lang.Thread.run(java.base@17-ea/Thread.java:831)

"JCS-ElementEventQueue-Thread-1" #37 daemon prio=5 os_prio=0 cpu=0,25ms elapsed=4994,05s tid=0x00007f868cdcfaf0 nid=0x3a4b waiting on condition  [0x00007f867e1ef000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@17-ea/Native Method)
	- parking to wait for  <0x00000000f38a86d8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.park(java.base@17-ea/LockSupport.java:341)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(java.base@17-ea/AbstractQueuedSynchronizer.java:506)
	at java.util.concurrent.ForkJoinPool.unmanagedBlock(java.base@17-ea/ForkJoinPool.java:3455)
	at java.util.concurrent.ForkJoinPool.managedBlock(java.base@17-ea/ForkJoinPool.java:3426)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(java.base@17-ea/AbstractQueuedSynchronizer.java:1623)
	at java.util.concurrent.LinkedBlockingQueue.take(java.base@17-ea/LinkedBlockingQueue.java:435)
	at java.util.concurrent.ThreadPoolExecutor.getTask(java.base@17-ea/ThreadPoolExecutor.java:1061)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@17-ea/ThreadPoolExecutor.java:1121)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@17-ea/ThreadPoolExecutor.java:635)
	at java.lang.Thread.run(java.base@17-ea/Thread.java:831)

"changeset-updater-0" #39 prio=5 os_prio=0 cpu=11,16ms elapsed=4993,56s tid=0x00007f8704a35c80 nid=0x3a4d waiting on condition  [0x00007f867e3f1000]
   java.lang.Thread.State: TIMED_WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@17-ea/Native Method)
	- parking to wait for  <0x00000000f38a96e8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.parkNanos(java.base@17-ea/LockSupport.java:252)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(java.base@17-ea/AbstractQueuedSynchronizer.java:1672)
	at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(java.base@17-ea/ScheduledThreadPoolExecutor.java:1182)
	at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(java.base@17-ea/ScheduledThreadPoolExecutor.java:899)
	at java.util.concurrent.ThreadPoolExecutor.getTask(java.base@17-ea/ThreadPoolExecutor.java:1061)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@17-ea/ThreadPoolExecutor.java:1121)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@17-ea/ThreadPoolExecutor.java:635)
	at java.lang.Thread.run(java.base@17-ea/Thread.java:831)

"DestroyJavaVM" #40 prio=5 os_prio=0 cpu=8077,05ms elapsed=4993,55s tid=0x00007f8704014870 nid=0x3a13 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Timer-1" #45 prio=6 os_prio=0 cpu=0,20ms elapsed=4983,11s tid=0x00007f8674217df0 nid=0x3a5a in Object.wait()  [0x00007f867e0ee000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(java.base@17-ea/Native Method)
	- waiting on <0x00000000f22bc818> (a java.util.TaskQueue)
	at java.lang.Object.wait(java.base@17-ea/Object.java:338)
	at java.util.TimerThread.mainLoop(java.base@17-ea/Timer.java:537)
	- locked <0x00000000f22bc818> (a java.util.TaskQueue)
	at java.util.TimerThread.run(java.base@17-ea/Timer.java:516)

"Map Status Collector" #47 daemon prio=6 os_prio=0 cpu=647,86ms elapsed=4982,45s tid=0x00007f86742e3a70 nid=0x3a5c waiting on condition  [0x00007f867ddea000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@17-ea/Native Method)
	- parking to wait for  <0x00000000f3f2b428> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.park(java.base@17-ea/LockSupport.java:341)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(java.base@17-ea/AbstractQueuedSynchronizer.java:506)
	at java.util.concurrent.ForkJoinPool.unmanagedBlock(java.base@17-ea/ForkJoinPool.java:3455)
	at java.util.concurrent.ForkJoinPool.managedBlock(java.base@17-ea/ForkJoinPool.java:3426)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(java.base@17-ea/AbstractQueuedSynchronizer.java:1623)
	at java.util.concurrent.LinkedBlockingQueue.take(java.base@17-ea/LinkedBlockingQueue.java:435)
	at org.openstreetmap.josm.gui.MapStatus$Collector.run(MapStatus.java:438)
	at java.lang.Thread.run(java.base@17-ea/Thread.java:831)

"WMS-downloader-0" #48 prio=5 os_prio=0 cpu=547,86ms elapsed=4981,94s tid=0x00007f86742fc740 nid=0x3a5d waiting on condition  [0x00007f867cbfe000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@17-ea/Native Method)
	- parking to wait for  <0x00000000f3f28430> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.park(java.base@17-ea/LockSupport.java:341)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(java.base@17-ea/AbstractQueuedSynchronizer.java:506)
	at java.util.concurrent.ForkJoinPool.unmanagedBlock(java.base@17-ea/ForkJoinPool.java:3455)
	at java.util.concurrent.ForkJoinPool.managedBlock(java.base@17-ea/ForkJoinPool.java:3426)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(java.base@17-ea/AbstractQueuedSynchronizer.java:1623)
	at java.util.concurrent.LinkedBlockingDeque.takeFirst(java.base@17-ea/LinkedBlockingDeque.java:485)
	at org.openstreetmap.josm.data.cache.HostLimitQueue.take(HostLimitQueue.java:107)
	at org.openstreetmap.josm.data.cache.HostLimitQueue.take(HostLimitQueue.java:28)
	at java.util.concurrent.ThreadPoolExecutor.getTask(java.base@17-ea/ThreadPoolExecutor.java:1061)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@17-ea/ThreadPoolExecutor.java:1121)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@17-ea/ThreadPoolExecutor.java:635)
	at java.lang.Thread.run(java.base@17-ea/Thread.java:831)

"WMS-downloader-1" #49 prio=5 os_prio=0 cpu=607,97ms elapsed=4981,94s tid=0x00007f86742f9b50 nid=0x3a5e waiting on condition  [0x00007f867cafd000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@17-ea/Native Method)
	- parking to wait for  <0x00000000f3f28430> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.park(java.base@17-ea/LockSupport.java:341)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(java.base@17-ea/AbstractQueuedSynchronizer.java:506)
	at java.util.concurrent.ForkJoinPool.unmanagedBlock(java.base@17-ea/ForkJoinPool.java:3455)
	at java.util.concurrent.ForkJoinPool.managedBlock(java.base@17-ea/ForkJoinPool.java:3426)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(java.base@17-ea/AbstractQueuedSynchronizer.java:1623)
	at java.util.concurrent.LinkedBlockingDeque.takeFirst(java.base@17-ea/LinkedBlockingDeque.java:485)
	at org.openstreetmap.josm.data.cache.HostLimitQueue.take(HostLimitQueue.java:107)
	at org.openstreetmap.josm.data.cache.HostLimitQueue.take(HostLimitQueue.java:28)
	at java.util.concurrent.ThreadPoolExecutor.getTask(java.base@17-ea/ThreadPoolExecutor.java:1061)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@17-ea/ThreadPoolExecutor.java:1121)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@17-ea/ThreadPoolExecutor.java:635)
	at java.lang.Thread.run(java.base@17-ea/Thread.java:831)

"WMS-downloader-2" #50 prio=5 os_prio=0 cpu=607,39ms elapsed=4981,92s tid=0x00007f8674301db0 nid=0x3a5f waiting on condition  [0x00007f867c9fc000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@17-ea/Native Method)
	- parking to wait for  <0x00000000f3f28430> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.park(java.base@17-ea/LockSupport.java:341)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(java.base@17-ea/AbstractQueuedSynchronizer.java:506)
	at java.util.concurrent.ForkJoinPool.unmanagedBlock(java.base@17-ea/ForkJoinPool.java:3455)
	at java.util.concurrent.ForkJoinPool.managedBlock(java.base@17-ea/ForkJoinPool.java:3426)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(java.base@17-ea/AbstractQueuedSynchronizer.java:1623)
	at java.util.concurrent.LinkedBlockingDeque.takeFirst(java.base@17-ea/LinkedBlockingDeque.java:485)
	at org.openstreetmap.josm.data.cache.HostLimitQueue.take(HostLimitQueue.java:107)
	at org.openstreetmap.josm.data.cache.HostLimitQueue.take(HostLimitQueue.java:28)
	at java.util.concurrent.ThreadPoolExecutor.getTask(java.base@17-ea/ThreadPoolExecutor.java:1061)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@17-ea/ThreadPoolExecutor.java:1121)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@17-ea/ThreadPoolExecutor.java:635)
	at java.lang.Thread.run(java.base@17-ea/Thread.java:831)

"VM Thread" os_prio=0 cpu=8625,82ms elapsed=5015,26s tid=0x00007f87041b2d60 nid=0x3a19 runnable  

"GC Thread#0" os_prio=0 cpu=72852,01ms elapsed=5015,86s tid=0x00007f87040365d0 nid=0x3a14 runnable  

"GC Thread#1" os_prio=0 cpu=73571,47ms elapsed=5014,78s tid=0x00007f86d4004570 nid=0x3a26 runnable  

"GC Thread#2" os_prio=0 cpu=72679,39ms elapsed=5013,35s tid=0x00007f86d4007010 nid=0x3a29 runnable  

"GC Thread#3" os_prio=0 cpu=72864,43ms elapsed=5011,58s tid=0x00007f86d4007980 nid=0x3a31 runnable  

"G1 Main Marker" os_prio=0 cpu=49,43ms elapsed=5015,86s tid=0x00007f8704039c10 nid=0x3a15 runnable  

"G1 Conc#0" os_prio=0 cpu=11461,80ms elapsed=5015,86s tid=0x00007f870403ac40 nid=0x3a16 runnable  

"G1 Refine#0" os_prio=0 cpu=54,85ms elapsed=5015,85s tid=0x00007f87040749f0 nid=0x3a17 runnable  

"G1 Refine#1" os_prio=0 cpu=3,79ms elapsed=5008,90s tid=0x00007f86d80013c0 nid=0x3a35 runnable  

"G1 Refine#2" os_prio=0 cpu=0,08ms elapsed=5000,59s tid=0x00007f868cce3030 nid=0x3a49 runnable  

"G1 Service" os_prio=0 cpu=1920,07ms elapsed=5015,85s tid=0x00007f87040759a0 nid=0x3a18 runnable  

"VM Periodic Task Thread" os_prio=0 cpu=7009,56ms elapsed=5015,20s tid=0x00007f87041e6480 nid=0x3a23 waiting on condition  

JNI global refs: 99, weak refs: 5125

Heap
 garbage-first heap   total 262144K, used 260154K [0x00000000f0000000, 0x0000000100000000)
  region size 1024K, 0 young (0K), 0 survivors (0K)
 Metaspace       used 60984K, committed 61312K, reserved 1105920K
  class space    used 7068K, committed 7232K, reserved 1048576K

Attachments (1)

21360-work.patch (3.3 KB ) - added by GerdP 3 years ago.
WIP : reduce memory leaks with TaggingPresets

Download all attachments as: .zip

Change History (12)

comment:1 by skyper, 3 years ago

Description: modified (diff)

comment:2 by Don-vip, 3 years ago

Resolution: wontfix
Status: newclosed

Things are unpredictable when memory runs out.

comment:3 by GerdP, 3 years ago

I think skyper tried to point out that the change of the preset has a memory leak?

comment:4 by skyper, 3 years ago

Yes, I do not understand why I ran out of memory, only changing the path between my two local copies of defaultpresets. Why does it work several times and then suddenly freezes JOSM?

Mean-while, I faced the "Out of memory" dialog in a different scenario. I still wonder, if JOSM cannot stop loading external presets or imageries if memory gets low instead of freezing completely.

Last edited 3 years ago by skyper (previous) (diff)

comment:5 by GerdP, 3 years ago

Why does it work several times and then suddenly freezes JOSM?

There really seems to be a memory leak.
I tried to reproduce like this:

  • start JOSM
  • open Preset Preferences
  • remove active preset "Internal Preset"
  • add new preset "myPreset" with path to c:\josm\core\resources\data\defaultpresets.xml
  • click OK
  • open Preset Preferences
  • click Reset button
  • click OK
  • open Preset Preferences ....

I see that more and more memory is allocated for org.openstreetmap.josm.gui.tagging.presets.items.PresetListEntry.
Will try to find the reason ...

I still wonder, if JOSM cannot stop loading external presets or imageries if memory gets low instead of freezing completely.

Not sure what you mean here. JOSM is more or less of no use when it cannot load data like imagery. As long as the data isn't loaded the free memory might be OK. I think there is no method in java to ask something like "will it work to load that image without running into memory problems?".

comment:6 by GerdP, 3 years ago

OK, problem is that class TaggingPreset adds itself as ActiveLayerChangeListener in the constructor, but there is no code to remove this listener when the preset is no longer needed. So, garbage collection never frees the memory for the preset.
Even worse: The current implementation calls TaggingPresetReader.readAll() twice to make sure that presets are readable.
Have to learn where to add code to remove the listener.

in reply to:  5 comment:7 by skyper, 3 years ago

Replying to GerdP:

I still wonder, if JOSM cannot stop loading external presets or imageries if memory gets low instead of freezing completely.

Not sure what you mean here. JOSM is more or less of no use when it cannot load data like imagery. As long as the data isn't loaded the free memory might be OK. I think there is no method in java to ask something like "will it work to load that image without running into memory problems?".

I do not know how much memory the "Out of Memory" dialog needs but maybe this amount of memory could be reserved for it. It is just a bad user experiences if the program stalls completely loading another imagery or file. User might even be able to free memory manually by deleting some layers but this is only possible if the program continues to work.

Last edited 3 years ago by skyper (previous) (diff)

comment:8 by mdk, 3 years ago

Alternatively we could create the dialog for this case on startup, even if we don't need him. This would "reserve" the memory for the dialog. In case of an "out of memory" error, only the dialog must be shown.

comment:9 by GerdP, 3 years ago

A possible improvement would be to remove the line

  MainApplication.getLayerManager().addActiveLayerChangeListener(this);

from the constructor of TaggingPreset. This constructor is used frequently for objects which are never used, e.g. in TaggingPresetPreference.TaggingPresetValidationListener.validatePreferences()
My understanding is that class TagggingPresets should have the complete list of active presets and thus can take care about the listeners whenever presets are added or removed.
Unfortunately there are other classes which keep references to presets, esp. ToolbarPreferences.
Should I open a new ticket for this?

by GerdP, 3 years ago

Attachment: 21360-work.patch added

WIP : reduce memory leaks with TaggingPresets

comment:10 by skyper, 3 years ago

Well, I still think, it would be nice if JOSM would not stall completely but if Vincent thinks this does not work or it is not worth fixing I cannot argue cause I have no clue.

Regarding the memory leaks, these might be the cause in this particular example, but not the solution in general. I think separate tickets are better as this one is closed as "wontfix", atm.

comment:11 by GerdP, 3 years ago

see #21446

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.