|
|
02-03-2019, 08:30
|
#1
|
Registered User
Join Date: Jun 2015
Boat: Chantier duu Port Rézé les Nantes, Mopélia 2000
Posts: 90
|
File opencpn.conf 'leaks' to 0 byte !
Hello OCPN friends !
I'm using OpenCPN on a RPi3, from OpenPlotter V1.2. in a PiDesktop configuration (with SSD and no SD card).
I repeatedly get the following issue : at startup, when lauching OpenCPN, I have the display of the initial 'warning message'. I hit the cancel button, and look in the /.opencpn directory, I can see the opencpn.conf files has now a size of zero byte !
(If I hit the accept button instead, then quit openCPN, this file will have a size of 5.2 kbytes.
My workaround is the following:
- to backup this file once, immediately after quitting OpenCPN (opencpn.conf.back).
- When the issue happens (often, ~10% of the launches), I quit OpenCPN,
- open the directory, kill the opencpn.conf ;
- and copy/rename opencpn.conf.back to it.
- lauch again openCPN ;
- Then I have to force a dabase reconstruction,
- and then only it works !
The issue uprise randomly, whichever way I used formerly to quit openCPN, whether with a ctrl+Q, or with the 'magic' stop button of my piDesktop...
Nota : the pidesktop includes one SSD and no SD cards, but the issue was the same when launching from an SD card...
Any suggestion ? All help much appreciated !
|
|
|
02-03-2019, 09:45
|
#2
|
Registered User
Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,196
|
Re: File opencpn.conf 'leaks' to 0 byte !
Didier...
The "not for navigation" warning message is displayed only once when you run a new version of OpenCPN (Which opens the config file and compares it's version with what is stored there). This means your config file was destroyed before you started OpenCPN and the message was shown. The size difference you observe after your two different actions in the warning dialog is caused by the simple fact that when you hit Cancel, OpenCPN shuts down immediately, while OK makes it generate a new default config file.
I would suspect that the reason for the destruction is not shutting down OpenCPN correctly. Which takes us to: What the heck is "the 'magic' stop button of my piDesktop"?
Pavel
|
|
|
02-03-2019, 12:16
|
#3
|
Registered User
Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,523
|
Re: File opencpn.conf 'leaks' to 0 byte !
Is this related to Lennart's effort here - Graceful shutdown?
It sure would be nice to make it work.
Worst case might be, if there is no file, have a prompt to look for the backup to use?
Have several opencpn.ini.bak created like navobj.xml's?
|
|
|
02-03-2019, 12:38
|
#4
|
Registered User
Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,196
|
Re: File opencpn.conf 'leaks' to 0 byte !
Quote:
Originally Posted by rgleason
Is this related to Lennart's effort here - Graceful shutdown?
It sure would be nice to make it work.
Worst case might be, if there is no file, have a prompt to look for the backup to use?
Have several opencpn.ini.bak created like navobj.xml's?
|
OpenCPN handles shutdown signals just fine (SIGHUP, SIGUSR1, SIGTERM, all trigger a correct shutdown, SIGKILL of course does not).
I haven't paid much attention to that text, but wonder if simply
Code:
ExecStart=/usr/bin/opencpn
KillMode=mixed
TimeoutStopSec=3
instead of the helper scripts used in the opencpn.service unit wouldn't do the same or better ( https://www.freedesktop.org/software...temd.kill.html)
Pavel
|
|
|
02-03-2019, 15:27
|
#5
|
Registered User
Join Date: Jun 2015
Boat: Chantier duu Port Rézé les Nantes, Mopélia 2000
Posts: 90
|
Re: File opencpn.conf 'leaks' to 0 byte !
Quote:
Originally Posted by nohal
Which takes us to: What the heck is "the 'magic' stop button of my piDesktop"?
Pavel
|
The pidesktop (element14) brings in a missing function in the Raspberry Pi : A short action on this button (connected to the GPIO) closes all running windows and shutdown gracefully the RPi, before switching the power off.
I don't suspect this to be the fault cause as the issue (opencpn.conf to zero byte) did happen before I used the pidesktop. It also happen after quitting OpenCPN and rebooting the Rpi ...
Note the file is not missing, it is empty !
|
|
|
02-03-2019, 15:33
|
#6
|
Registered User
Join Date: Jun 2015
Boat: Chantier duu Port Rézé les Nantes, Mopélia 2000
Posts: 90
|
Re: File opencpn.conf 'leaks' to 0 byte !
Quote:
Originally Posted by rgleason
Is this related to Lennart's effort here - Graceful shutdown?
It sure would be nice to make it work.
Worst case might be, if there is no file, have a prompt to look for the backup to use?
Have several opencpn.ini.bak created like navobj.xml's?
|
Being not an expert, I would answer most probably yes !
Note the file is not missing, it exists with a zero byte count ...
|
|
|
02-03-2019, 15:56
|
#7
|
Registered User
Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,196
|
Re: File opencpn.conf 'leaks' to 0 byte !
Quote:
Originally Posted by Didier B
The pidesktop (element14) brings in a missing function in the Raspberry Pi : A short action on this button (connected to the GPIO) closes all running windows and shutdown gracefully the RPi, before switching the power off.
I don't suspect this to be the fault cause as the issue (opencpn.conf to zero byte) did happen before I used the pidesktop. It also happen after quitting OpenCPN and rebooting the Rpi ...
Note the file is not missing, it is empty !
|
Closes the windows how?
|
|
|
02-03-2019, 17:51
|
#8
|
Registered User
Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,523
|
Re: File opencpn.conf 'leaks' to 0 byte !
Have added that to the top.
https://opencpn.org/wiki/dokuwiki/do...le_alternative
Quote:
Originally Posted by nohal
OpenCPN handles shutdown signals just fine (SIGHUP, SIGUSR1, SIGTERM, all trigger a correct shutdown, SIGKILL of course does not).
I haven't paid much attention to that text, but wonder if simply
Code:
ExecStart=/usr/bin/opencpn
KillMode=mixed
TimeoutStopSec=3
instead of the helper scripts used in the opencpn.service unit wouldn't do the same or better ( https://www.freedesktop.org/software...temd.kill.html)
Pavel
|
|
|
|
02-03-2019, 18:43
|
#9
|
Registered User
Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,196
|
Re: File opencpn.conf 'leaks' to 0 byte !
Quote:
Originally Posted by rgleason
|
Rick...
Now that thing finally lost any value it could perhaps have. I will repeat it once again: You can't blindly copy every piece of text you see in the forum to the manual, it has exactly the opposite effect than what you intend to do.
|
|
|
02-03-2019, 20:07
|
#10
|
Marine Service Provider
Join Date: Mar 2008
Posts: 7,387
|
Re: File opencpn.conf 'leaks' to 0 byte !
Didier B...
Seems pretty likely that OCPN is being KILLed harshly, and not getting a chance to tidy up the workspace.
Have you looked at the last few line of the logfile when you find the .conf file corrupted?
Something like the listing below is normal. Note the "exiting cleanly" entries. If those are missing, then OCPN was interrupted during shutdown.
Code:
22:54:14 EST: PlugInManager: Deactivating PlugIn: /usr/local/lib/opencpn/libwmm_pi.so
22:54:14 EST: PlugInManager: Deactivating PlugIn: /usr/local/lib/opencpn/libchartdldr_pi.so
22:54:14 EST: chartdldr_pi: DeInit
22:54:14 EST: PlugInManager: Deactivating PlugIn: /usr/local/lib/opencpn/liboesenc_pi.so
22:54:14 EST: PlugInManager: Deactivating PlugIn: /usr/local/lib/opencpn/libdashboard_pi.so
22:54:14 EST: PlugInManager: Deactivating PlugIn: /usr/local/lib/opencpn/libgrib_pi.so
22:54:14 EST: PlugInManager: Deactivating PlugIn: /usr/local/lib/opencpn/libs63_pi.so
22:54:14 EST: opencpn::MyFrame exiting cleanly.
22:54:14 EST: Chart cache purge
22:54:14 EST: Chart cache PlugIn purge
22:54:14 EST: PlugInManager: Deactivating PlugIn: /usr/local/lib/opencpn/libwmm_pi.so
22:54:14 EST: PlugInManager: Deactivating PlugIn: /usr/local/lib/opencpn/libchartdldr_pi.so
22:54:14 EST: PlugInManager: Deactivating PlugIn: /usr/local/lib/opencpn/liboesenc_pi.so
22:54:14 EST: PlugInManager: Deactivating PlugIn: /usr/local/lib/opencpn/libdashboard_pi.so
22:54:14 EST: PlugInManager: Deactivating PlugIn: /usr/local/lib/opencpn/libgrib_pi.so
22:54:14 EST: PlugInManager: Deactivating PlugIn: /usr/local/lib/opencpn/libs63_pi.so
22:54:14 EST: Closing NMEA Datastream UDP:0.0.0.0:2947
22:54:14 EST: Chart cache purge
22:54:14 EST: opencpn::MyApp starting exit.
22:54:14 EST: LOGBOOK: 2019-03-03 03:54:14 UTC OFF: Lat 27.66050 Lon -80.37210
22:54:14 EST: UnLoading Tide/Current data source: /usr/local/share/opencpn/tcdata/HARMONIC.IDX
22:54:14 EST: opencpn::MyApp exiting cleanly...
Dave
|
|
|
02-03-2019, 22:16
|
#11
|
Registered User
Join Date: Jun 2015
Boat: Chantier duu Port Rézé les Nantes, Mopélia 2000
Posts: 90
|
Re: File opencpn.conf 'leaks' to 0 byte !
Quote:
Originally Posted by nohal
Closes the windows how?
|
The power control is described here : https://github.com/pi-desktop/pi-des...wer-control.md
|
|
|
02-03-2019, 23:44
|
#12
|
Registered User
Join Date: Jun 2015
Boat: Chantier duu Port Rézé les Nantes, Mopélia 2000
Posts: 90
|
Re: File opencpn.conf 'leaks' to 0 byte !
Hi Dave,
to answer you, I 1st did some house keeping in the log file (select all, delete, save) ;
Then I re-started the Pi using the on/off buttotn. This launched OpenCPN.
Then after a while playing with OP, new restart using the on/off button, and YES, it happened again. (loss of conf file).
I downloaded the log file and attached to this post.
Remark : .log extension is not allowed on this forum, so I changed the extension to .txt, BUT txt files are limited to 1 kb ! so I changed again the extension to .pdf ! Plse change it back to what you like and read the file with a text editor (like NOTEPAD++) as it contains a number of 'NUL' nonASCII characters - txt readers just cut at this point !
Whatsoever, we can see the session of OP, starting line 3 at 07:39:55, and ending cleanly at line 139 : 07:40:30 CET: opencpn::MyApp exiting cleanly... (note line 22 : 07:39:57 CET: Config file language: fr_FR)
This corresponds to the graceful stopping via the button of the PiDesktop.
Then appears a quantity of NUL characters (non ASCII), then comes the next session of OP,
note line 161 : 07:42:53 CET: Config file language: en_US, which confirms that the content of the conf file was lost !
|
|
|
03-03-2019, 02:00
|
#13
|
Registered User
Join Date: Jun 2015
Posts: 379
|
Re: File opencpn.conf 'leaks' to 0 byte !
Quote:
Originally Posted by Didier B
Hi Dave,
This corresponds to the graceful stopping via the button of the PiDesktop.
Then appears a quantity of NUL characters (non ASCII), then comes the next session of OP,
note line 161 : 07:42:53 CET: Config file language: en_US, which confirms that the content of the conf file was lost !
|
There's a lot of ascii 0 in this file.
This and the 0 size conf is rather common when the fs isn't properly sync before shutdown.
Even if Wx files functions aren't encouraging best practices for opening, reading and writing files doing it the right way may have bad side effect across all OS.
At least on linux you have to sync the data then sync the directory but on some linux version it's very slow, it syncs the whole disk! Anyway you can't reliably know the actual directory and don't let me start with these TOCTOU races all around the place.
Best would be for your button to properly do its jobs and sync or journals the disk, meta data AND data.
|
|
|
03-03-2019, 03:46
|
#14
|
Registered User
Join Date: Oct 2014
Location: Netherlands
Boat: Halmatic 30
Posts: 1,101
|
Re: File opencpn.conf 'leaks' to 0 byte !
Quote:
Originally Posted by did-g
There's a lot of ascii 0 in this file.
This and the 0 size conf is rather common when the fs isn't properly sync before shutdown.
Even if Wx files functions aren't encouraging best practices for opening, reading and writing files doing it the right way may have bad side effect across all OS.
At least on linux you have to sync the data then sync the directory but on some linux version it's very slow, it syncs the whole disk! Anyway you can't reliably know the actual directory and don't let me start with these TOCTOU races all around the place.
Best would be for your button to properly do its jobs and sync or journals the disk, meta data AND data.
|
Perhaps it is a case of timing with your HD.
Use the latest OpenCPN 4.99.1428 and use the latest updates of Raspian and the latest kernel version.
It works here without problems and very fast with OpenGL screen movements. Also with oesenc-pi plugin.
Regards,
Bram
|
|
|
07-03-2019, 07:24
|
#15
|
Registered User
Join Date: Jun 2015
Boat: Chantier duu Port Rézé les Nantes, Mopélia 2000
Posts: 90
|
Re: File opencpn.conf 'leaks' to 0 byte !
Quote:
Originally Posted by did-g
.../...
Best would be for your button to properly do its jobs and sync or journals the disk, meta data AND data.
|
I am not sure the button has any responsibility in this issue, as :
- I have observed the problem before using the pi desktop ;
- It upraised again yesterday, though I had formerly halted Opencpn with a CTRL+Q, before shutting down the rpi ...
|
|
|
|
|
Thread Tools |
Search this Thread |
|
|
Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
Advertise Here
Recent Discussions |
|
|
|
|
|
|
|
|
|
|
|
|
Vendor Spotlight |
|
|
|
|