wellenvogel / avnav

using the raspberry pi as a nav computer
MIT License
87 stars 27 forks source link

Connection errors in logfile #385

Open Fietsenwiel opened 16 hours ago

Fietsenwiel commented 16 hours ago

I see connection errors in the logfile but i don't make any connection. In Signal-k i disabled all connections:

`During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/avnav/server/handler/socketbase.py", line 111, in readSocket raise Exception("no data received within timeout of %s seconds"%str(timeout)) Exception: no data received within timeout of 50.0 seconds

2024-11-14 13:28:55,362-592-905-signalk-INFO-disconnected from socket unknown connection 2024-11-14 13:28:57,364-592-905-signalk-INFO-STATUS[main] RUNNING, connected to localhost:10110 2024-11-14 13:28:57,364-592-905-signalk-INFO-successfully connected to localhost:10110 2024-11-14 13:28:57,365-592-905-signalk-INFO-STATUS[main] NMEA, connected to localhost:10110 2024-11-14 13:28:57,365-592-905-signalk-INFO-unknown connection established, start reading 2024-11-14 13:28:57,365-592-905-signalk-INFO-STATUS[main:#:reader] RUNNING, receiving unknown connection 2024-11-14 13:29:47,447-592-905-signalk-ERROR-exception while reading from socket: Traceback (most recent call last): File "/usr/lib/avnav/server/handler/socketbase.py", line 102, in readSocket data = sock.recv(1024) socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/avnav/server/handler/socketbase.py", line 111, in readSocket raise Exception("no data received within timeout of %s seconds"%str(timeout)) Exception: no data received within timeout of 50.0 seconds

2024-11-14 13:29:47,448-592-905-signalk-INFO-disconnected from socket unknown connection 2024-11-14 13:29:49,449-592-905-signalk-INFO-STATUS[main] RUNNING, connected to localhost:10110 2024-11-14 13:29:49,449-592-905-signalk-INFO-successfully connected to localhost:10110 2024-11-14 13:29:49,450-592-905-signalk-INFO-STATUS[main] NMEA, connected to localhost:10110 2024-11-14 13:29:49,450-592-905-signalk-INFO-unknown connection established, start reading 2024-11-14 13:29:49,450-592-905-signalk-INFO-STATUS[main:#:reader] RUNNING, receiving unknown connection`

Everything works fine but this should not happen gues? Only somtimes, the o-charts disapears, restarting avnav brings it back then.

The Avnav version is 20240616 on a Raspberry pi 4b.

wellenvogel commented 15 hours ago

Would be helpful to attach your config... But from the log: Normally socket connections in AvNav will close and reopen if there is no data received within the timeout (otherwise you would potentially not detect a dead connection). And this messages are created from a SocketReader you named "signalk". If you don't route data through SignalK you most probably don't need this reader. So just disable it. The connection settings in SignalK are not relevant for this issue.

Only somtimes, the o-charts disapears, restarting avnav brings it back then.

Not sure what exactly this means. Especially: Which ocharts version (ochartsng?), what means "disapears", what do you restart... Btw: please create separate issue for different problems.

Fietsenwiel commented 15 hours ago

Here is my config:

<?xml version="1.0" ?><AVNServer>
<!-- some basic configuration
     debugToLog controls whether any debug output will also go to the logfile
     you can change the loglevel by an HTTP request to the navurl:
     http://somehost:8080/viewer/avnav_navi.php?request=debuglevel&level=DEBUG
     maxtimeback: maximal time in seconds that we allow the system clock to go back before we delete all data
     settimecmd: command to set the systemtime (must accept time in format like date - utc - and must be able to run as pi)
     systimediff: timediff in seconds between gps timestamp and system time that we allow before we set gps time
     settimeperiod: time in seconds befor we retry setting the systemtime
-->
<AVNConfig debug="0" debugToLog="true" expiryTime="300" logfile="/home/pi/avnav/data/log/avnav.log" maxtimeback="5" ownMMSI="244198117" settimecmd="" settimeperiod="3600" systimediff="5"/>
<!-- the workers section -->
<Workers>
<AVNGpsdFeeder gpsdcommand="/usr/sbin/gpsd -b -n -N -G" listenerPort="4020" port="2948" useGpsd="false"/>
<!-- the universal feeder 
     the gpsd is only here for compatibility with old set ups
     if you still enable it here, a couple of features will not work
     as dpsd lacks some decoders we need
     so leave this entry untouched
     -->

<!-- the Web server
     the port defaults to 8080, the host to "any"
     set the translation between URLs and real pathes as you need
     the navurl is the url that is used to control any nav feature
     this of course must fit to the java script part...
-->
<AVNHttpServer httpPort="8080" index="/viewer/avnav_viewer.html" navurl="/viewer/avnav_navi.php">
    <Directory path="/home/pi/avnav/data/charts" urlpath="maps"/>
    <Directory path="/home/pi/avnav/data/log" urlpath="log"/>
    <Directory path="/home/pi/avnav/data/tracks" urlpath="tracks"/>
    <Directory path="/home/pi/avnav/data/routes" urlpath="routes"/>
    <MimeType extension=".avt" type="text/plain"/>
    <MimeType extension=".log" type="text/plain"/>
</AVNHttpServer>
<!-- the writer for track data
     tracks are written in a simple file
     each line consists of:
     timestamp,lat,lon,course,speed
     timestamp being in ISO8601 format, others in float
     interval is the minimum interval between writing trackpoints
     mindistance is the minimum distance in m before a new trackpoint is written (interval wins)
      -->
<AVNTrackWriter interval="10" mindistance="50" trackdir="/home/pi/avnav/data/tracks"/>
<!-- an TCP writer that will provide data from the feeder input to other systems
     port - the listener port
     filter can be either $XXX,... - the NMEA setence, in this case the first 2 characters are ignored or
            any other value like !AIVDM. If not set or empty any data will be sent out
     address - if set, only bind to this address, otherwise allow connections from any port
         read    - if set to true allow data input from connected devices
         minTime - when reading data wait that many milliseconds between records to avoid overloading
         readFilter - if set, only read filtered data
 -->
<!-- a tcp socket that will output all NMEA data that AvNav has received
     you can customize it using the filter -->
<AVNSocketWriter blackList="signalk" filter="" maxDevices="5" minTime="50" name="tosignalk" port="28628" read="true"/>
<!-- <AVNSocketWriter address="127.0.0.1" blackList="signalk" enabled="True" filter="" maxDevices="6" minTime="50" name="tosignalk" port="28628" read="true"/>
    the following entries provide the integration with signalk and canboat
     we provide a connector to canboat (n2kd) to receive all data that has been translated from nmea2000 to nmea0183
     we provide an additional socket that will provide only the nmea data that has not been received from canboat
       this will be used for signalk to get all of our nmea0183. signalk will itself connect to canboat to get the nmea2000
       directly, inside signalk just configure a connector to this port and the canboat nmea200 connector
     we additional have 2 plugins:
       * signalk: will receive all data at vessels/self from signalk and store it at gps.signalk in our store
       * canboat: will receive pgns that are not translated to NMEA0183 - currently only 126992 to get the time
     for canboat to work you potentially need to modify /etc/default/n2kd and /boot/config.txt
-->
<!-- ##SIGNALK CANBOAT
<AVNSocketWriter port="34568" maxDevices="5" filter="" read="true" minTime="50" name="nmea0183tosignalk" blackList="canboatnmea0183,canboatgen"/>
<AVNSocketReader port="2599" host="localhost" filter="" name="canboatnmea0183"/>
 ##SIGNALK CANBOAT-->
<AVNSocketReader filter="^$RMB" host="localhost" name="signalk" port="10110"/>
<AVNPluginHandler>
        <builtin-signalk enabled="true" migrated="True"/>
<!-- ##CANBOAT 
    <builtin-canboat enabled="true" allowKeyOverwrite="true" autoSendRMC="30" sourceName="canboatgen"/>
 ##CANBOAT -->
<system-history period="30.0" sensorNames="" storeKeys="gps.speed,gps.signalk.navigation.attitude.roll,gps.signalk.environment.inside.temperature,gps.signalk.environment.inside.pressure,gps.transducers.HumidityBinnen,gps.signalk.temp-buiten-temperature,gps.signalk.temp-koelkast-temperature,gps.signalk.temp-binnen-temperature" storeTime="72"/>
<builtin-canboat enabled="False"/>
<user-seatalk-remote enabled="False"/>
<builtin-Sail_Instrument TWD_filtFreq="0.2"/>
<system-Sail_Instrument allow_fallback="True" calc_vmc="False" ground_wind="" gybe_angle="0" laylines_from_matrix="False" lee_factor="10" minmax_samples="200" show_polar="True" smoothing_factor="0.1" tack_angle="0" write_data="False" period="1" laylines_polar="False" wmm_file="WMM2020.COF" wmm_period="600" depth_transducer="-1" draught="-1" nmea_write="False" nmea_filter="" nmea_priority="10" nmea_id="CA" nmea_decode="True"/>
</AVNPluginHandler>

<!-- create chart overview files -->
<AVNChartHandler/>
<!--  routing handler 
      additional parameters:
      interval: interval in seconds for computing RMB data (default: 5)
      computeRMB: default True, set to false if you do not want RMB computation
-->
<AVNRouter routesdir="/home/pi/avnav/data/routes" useRhumbLine="True"/>
<!-- log nmea data
     will create .nmea(.gz) files in the tracks directory
     parameters:
     maxfiles: the number of logs (1 per day) that are kept - default 100
     filter: the filter for the sentences to be written, default "$RMC,$DBT,$DBP" - suitable to help openseamap by logging depth
     interval: minimal interval in seconds between sentences of the same type (default: 5)
-->
<AVNNmeaLogger/>
<AVNImporter importDir="/home/pi/avnav/data/import"/>
<!-- add the following property to AVNWpaHandler to be able to allow external access for wlan client
     firewallCommand="sudo -n $BASEDIR/../raspberry/iptables-ext.sh wlan-av1"
-->
<AVNCommandHandler>
    <Command command="sudo shutdown -P" name="shutdown"/>
    <Command command="/usr/lib/python3/dist-packages/openplotterAvnav/data/sound.sh 90%" name="sound" repeat="1"/>
        <Command command="/usr/bin/python" name="pythonalarm"/>
        <Command command="collision" name="sound" repeat="1"/>
</AVNCommandHandler>

<AVNAlarmHandler>
        <Alarm category="info" name="waypoint" repeat="1"/>
        <Alarm category="info" name="connectionLost" repeat="0"/>
        <Alarm category="critical" name="anchor" repeat="20000"/>
        <Alarm category="critical" name="gps" repeat="20000"/>
        <Alarm category="critical" name="mob" repeat="2"/>
        <!-- with the next line we configuer a special command that will be called when we receive a "sinking" notification from SignalK
             the sound is determined by the category - and this is also the parameter that the command will receive -->
        <Alarm category="critical" command="sinkingAlarm" name="sk:sinking" repeat="2"/>
        <Alarm category="critical" name="sk:danger.collision" repeat="1"/>
        <Alarm command="pythonalarm" name="anchor" parameter="/home/pi/scripts/anchoralarm.py" repeat="1"/>
</AVNAlarmHandler>

</Workers>
<AVNUserAppHandler><UserTool icon="/user/images/SPDicoon.PNG" keepUrl="True" name="854e069889c4ec91d2004ab3f5ab1937" newWindow="false" title="Sailing Performance Dashboard" url="http://$HOST/SPD/spd.html"/>
<UserTool icon="/user/images/radio-transmitter.png" keepUrl="True" name="e189f2009cea2f22ba826a801bf03c5f" newWindow="false" title="None" url="http://$HOST:3000/vhfinfo"/>
<UserTool icon="/user/images/Metertje.PNG" keepUrl="True" name="a4fe4205ec9c435b8741f64a3564edfc" title="" url="http://$HOST:3000/@mxtommy/kip/#/page/0"/>
<UserTool icon="/user/images/Zeilboot.png" keepUrl="True" name="673f80de3873186cdb9732df5464760e" newWindow="false" url="http://$HOST:3000/signalk-trim-plugin/#"/>
<UserTool icon="/user/images/Windvaan.PNG" keepUrl="True" name="12b16a34b7814904e512e8552690df5f" newWindow="true" url="https://nl.windfinder.com/#10/51.7785/4.5607"/>
<UserTool icon="/user/images/Windvaan.PNG" keepUrl="True" name="5cb4274b2967130112a04c51636f1db8" title="" url="http://weerlive.nl/index.php?pagina=hwind"/>
<UserTool icon="/user/images/Docs.png" keepUrl="True" name="3515f96cb20596a49b16c8f7a4f1a867" title="" url="http://$HOST:80/Relexed.html"/>
<UserTool icon="/user/images/log-icon.png" keepUrl="True" name="c8cb7a6bb0849c9fa616d47684ac69fe" newWindow="true" title="elog" url="http://$HOST:9091/relexed/"/>
<UserTool icon="/user/images/S100.png" keepUrl="True" name="8bbf1233b57e02156658b05b82d095e0" newWindow="false" title="null" url="http://$HOST:3000/@signalk/signalk-autopilot/"/>
<UserTool icon="/user/images/Tiden.png" keepUrl="True" name="f0082465a6ba9b4e8ef63d281de243a2" newWindow="false" url="http://$HOST:3000/sk-tidal-dashboard"/>
<UserTool icon="/user/images/zigbee2mqtt.jpg" url="http://$HOST:8090/#/dashboard" newWindow="true" keepUrl="True" name="a91922dfeea560a846605da9ca47bc9b"/>
</AVNUserAppHandler>

<AVNSignalKHandler fetchCharts="False" migrated="True" password="alsk1298" receiveNotifications="True" sendData="True" userName="pi" uuid="23e61eee-cf4e-461c-8b6c-e283d627731f"/>
</AVNServer>

I do use signalk but I disabled all connections to see if the problem would disappear. It didn't. And I thought that disapearing of o-charts (no ochart maps available anymore) was related to this problem. If not I will make an other issue.

wellenvogel commented 11 hours ago

So as I wrote... If there is no data on the signalk connection it will close and reopen. If you do not want this, set the timeout at this connection to a very large value like 31104000... For sure not related to any ocharts issue. But:

no ochart maps available anymore

is not very clear... If this happens on the main page - we need all the logs (avnav, ocharts) and all version + system info.