Modify

Opened 15 months ago

Closed 15 months ago

Last modified 15 months ago

#23505 closed defect (fixed)

incorrect number of modified ways in command, improve performance, fix memory leak

Reported by: GerdP Owned by: *Martin*
Priority: normal Milestone:
Component: Plugin simplifyArea Version:
Keywords: template_report Cc: stoecker, taylor.smock

Description

What steps will reproduce the problem?

  1. Add a node to a rectangular building
  2. Select the building
  3. Press Shift+Ctrl+Y to "Simplify Area"

What is the expected result?

A command on the undo/redo stack that says something like "Simplified 1 way"
The command to remove the node should be a ChangeNodesCommand, not a ChangeCommand (see #19885)

What happens instead?

A command on the undo/redo stack that says something like "Simplified 3 ways" and contains two

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

While working on a fix I found some more problems:

  1. Crash report when the selection contains incomplete ways
  2. Slow execution when many ways are selected
Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2024-02-05 12:56:34 +0100 (Mon, 05 Feb 2024)
Revision:18969
Build-Date:2024-02-06 02:30:58
URL:https://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (18969 en) Windows 10 64-Bit
OS Build number: Windows 10 Pro 2009 (19045)
Memory Usage: 644 MB / 1888 MB (221 MB allocated, but free)
Java version: 17.0.8+7-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM
Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
Screen: \Display0 1920×1080 (scaling 1.00×1.00)
Maximum Screen Size: 1920×1080
Best cursor sizes: 16×16→32×32, 32×32→32×32
System property file.encoding: Cp1252
System property sun.jnu.encoding: Cp1252
Locale info: en_DE
Numbers with default locale: 1234567890 -> 1234567890
VM arguments: [-Djpackage.app-version=1.5.18789, --add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web, --add-exports=java.base/sun.security.action=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.spi=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, -Djpackage.app-path=%UserProfile%\AppData\Local\JOSM\HWConsole.exe]
Dataset consistency test: No problems found

Plugins:
+ OpeningHoursEditor (36196)
+ RoadSigns (36196)
+ SimplifyArea (36200)
+ apache-commons (36176)
+ buildings_tools (36200)
+ comfort0 (36200)
+ o5m (36126)
+ pbf (36176)
+ poly (36126)
+ reverter (36196)
+ splinex (36126)
+ undelete (36126)
+ utilsplugin2 (36200)

Validator rules:
+ d:\java_tools\JOSM\mygeometry.mapcss
+ https://josm.openstreetmap.de/josmfile?page=Rules/GermanySpecific&zip=1
+ c:\josm\core\resources\data\validator\geometry.mapcss

Last errors/warnings:
- 00000.576 W: extended font config - overriding 'filename.Myanmar_Text=mmrtext.ttf' with 'MMRTEXT.TTF'
- 00000.578 W: extended font config - overriding 'filename.Mongolian_Baiti=monbaiti.ttf' with 'MONBAITI.TTF'
- 00000.982 E: java.security.KeyStoreException: Windows-ROOT not found. Cause: java.security.NoSuchAlgorithmException: Windows-ROOT KeyStore not available

Attachments (2)

commands.JPG (24.3 KB ) - added by GerdP 15 months ago.
screen shot showing too complex command
23505.patch (7.7 KB ) - added by GerdP 15 months ago.
patch for all mentioned problems

Download all attachments as: .zip

Change History (10)

by GerdP, 15 months ago

Attachment: commands.JPG added

screen shot showing too complex command

by GerdP, 15 months ago

Attachment: 23505.patch added

patch for all mentioned problems

comment:1 by GerdP, 15 months ago

Cc: stoecker taylor.smock added

Probably stupid question: What's the right way to distribute a new binary for a plugin now? Do I still compile with JDK 8?

in reply to:  1 comment:2 by taylor.smock, 15 months ago

What's the right way to distribute a new binary for a plugin now?

For svn plugins, still svn. For GitHub plugins, the GitHub release system (I've got a GH action to autorelease updates).

Do I still compile with JDK 8?

Ideally, yes. It shouldn't be a problem to compile with a newer version of Java though. I usually compile with Java 8 just to avoid any potential issues, and to reduce the differences between builds.

See java.lang.version.

EDIT: There is a 99.9999% chance of no issues if you compile with Java 21, for example. Assuming that the plugin is using build-common.xml and hasn't overridden java.lang.version somehow.

Last edited 15 months ago by taylor.smock (previous) (diff)

comment:3 by taylor.smock, 15 months ago

As an alternative to doing it yourself, you can wait for me to do another i18n update where I recompile all the plugins anyway.

comment:4 by GerdP, 15 months ago

OK, thanks. I still have JDK, I just have to check if mainVersion is up to date. If nobody complains I'll release the patch tomorrow.

comment:5 by taylor.smock, 15 months ago

Why aren't you using Way#isUsable? I assume you have a good reason.

-        ways.removeIf(w -> w.isIncomplete() || w.hasIncompleteNodes());
+        ways.removeIf(w -> !w.isUsable());
Version 0, edited 15 months ago by taylor.smock (next)

comment:6 by GerdP, 15 months ago

No good reason, your code is better.

comment:7 by GerdP, 15 months ago

Resolution: fixed
Status: newclosed

In 36209/osm:

fix #23505: incorrect number of modified ways in command, improve performance, fix memory leak

  • collect modifed ways to avoid two change commands per way
  • use ChangeNodesCommand instead of ChangeCommand to avoid memory leak
  • use core code to check if nodes are outside downloaded area
  • store selected ways in HashSet to avoid multiple sequential searches in averageNearbyNodes()

comment:8 by GerdP, 15 months ago

In 36210/osm:

see #23505: dist

Modify Ticket

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