Modify

Opened 3 years ago

Last modified 3 years ago

#16408 new enhancement

JOSM is reloading multiple times a modified validation file

Reported by: naoliv Owned by: team
Priority: minor Milestone:
Component: Core Version:
Keywords: reload file watch event Cc:

Description

It seems that #15282 is back.
While saving a local validation file I can see that JOSM is reloading it 3 times:

2018-06-20 08:19:27.182 INFO: Source Brasil has been modified. Reloading it...
2018-06-20 08:19:27.222 INFO: Source Brasil has been modified. Reloading it...
2018-06-20 08:19:27.244 INFO: Source Brasil has been modified. Reloading it...

JOSM:

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2018-06-19 19:44:45 +0200 (Tue, 19 Jun 2018)
Revision:13959
Build-Date:2018-06-19 17:47:20
URL:https://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (13959 en) Linux Debian GNU/Linux testing (buster)
Memory Usage: 871 MB / 7168 MB (690 MB allocated, but free)
Java version: 10.0.1+10-Debian-4, Oracle Corporation, OpenJDK 64-Bit Server VM
Screen: :0.0 1600x900, :0.1 1280x1024
Maximum Screen Size: 1600x1024
Java package: openjdk-10-jre:amd64-10.0.1+10-4
Java ATK Wrapper package: libatk-wrapper-java:all-0.33.3-21
VM arguments: [--add-modules=java.activation,java.se.ee, -Dawt.useSystemAAFontSettings=gasp]
Program arguments: [--language=en]
Dataset consistency test: No problems found

Attachments (0)

Change History (9)

comment:1 Changed 3 years ago by Don-vip

I can't reproduce with same version of Java and Windows. Do you have another machine with a different OS to see if it's specific to Debian?

comment:2 Changed 3 years ago by naoliv

Sure, I will see if I can test it using a live CD of another distro.
But doing some more tests:

  • With a simple touch I can see that JOSM only reloads it a single time
    2018-06-20 14:11:50.482 INFO: Source Brasil has been modified. Reloading it...
    
  • Only opening the file for edition (without editing or saving it) I see 3 events:
    2018-06-20 14:13:21.537 FINE: Received ENTRY_CREATE event for unregistered file: /arquivos/git/validador-josm/.Rules_Brazilian-Specific.validator.mapcss.swp
    2018-06-20 14:13:21.538 FINE: Received ENTRY_CREATE event for unregistered file: /arquivos/git/validador-josm/.Rules_Brazilian-Specific.validator.mapcss.swp
    2018-06-20 14:13:21.538 FINE: Received ENTRY_MODIFY event for unregistered file: /arquivos/git/validador-josm/.Rules_Brazilian-Specific.validator.mapcss.swp
    
  • Saving the file (without closing it):
    2018-06-20 14:14:06.548 FINE: Received ENTRY_CREATE event for unregistered file: /arquivos/git/validador-josm/Rules_Brazilian-Specific.validator.mapcss~
    2018-06-20 14:14:06.548 FINE: Received ENTRY_MODIFY event for unregistered file: /arquivos/git/validador-josm/.Rules_Brazilian-Specific.validator.mapcss.swp
    2018-06-20 14:14:06.590 FINE: Received ENTRY_MODIFY event for unregistered file: /arquivos/git/validador-josm/.Rules_Brazilian-Specific.validator.mapcss.swp
    2018-06-20 14:14:06.633 INFO: Source Brasil has been modified. Reloading it...
    2018-06-20 14:14:06.718 INFO: Source Brasil has been modified. Reloading it...
    
  • Saving and closing:
    2018-06-20 14:15:11.956 FINE: Received ENTRY_CREATE event for unregistered file: /arquivos/git/validador-josm/Rules_Brazilian-Specific.validator.mapcss~
    2018-06-20 14:15:11.957 INFO: Source Brasil has been modified. Reloading it...
    2018-06-20 14:15:11.978 INFO: Source Brasil has been modified. Reloading it...
    2018-06-20 14:15:11.999 INFO: Source Brasil has been modified. Reloading it...
    2018-06-20 14:15:12.046 INFO: Source Brasil has been modified. Reloading it...
    

Maybe it could be related with the ENTRY_CREATE and ENTRY_MODIFY of the unrelated .mapcss.swp and .mapcss~ files?
ie, JOSM is receiving an unrelated event and reloading the validation file.

comment:3 Changed 3 years ago by Don-vip

Ah! What text editor are you using to modify the file?

comment:4 Changed 3 years ago by naoliv

I am using vim
Maybe it's possible to watch only the registered file or ignore any unrelated event?

comment:5 Changed 3 years ago by Don-vip

It seems Linux behaves differently than what I can see on Windows:

WatcherServices reports events twice because the underlying file is updated twice. Once for the content and once for the file modified time. These events happen within a short time span. To solve this, sleep between the poll() or take() calls and the key.pollEvents() call.

comment:6 Changed 3 years ago by Don-vip

Milestone: 18.06

comment:7 Changed 3 years ago by Don-vip

Keywords: reload file watch event added
Milestone: 18.0618.07

comment:8 Changed 3 years ago by Don-vip

Milestone: 18.0718.08

comment:9 Changed 3 years ago by Don-vip

Milestone: 18.08

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set.
to The owner will be changed from team to the specified user.
The owner will change to naoliv
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous.

Add Comment


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

 
Note: See TracTickets for help on using tickets.