htool / vhfinfo

VHF channel information based on GeoJSON data. Plugin for SignalK included.
Apache License 2.0
3 stars 6 forks source link

VHFinfo causes network problems when no GPS signal #16

Open Fietsenwiel opened 1 week ago

Fietsenwiel commented 1 week ago

When there are no GPS coordinates vhfinfo causes networkproblems. I use AvNav with o-charts, because of the networkproblems the o-charts don't work after a while.

I see a lot of error messages: info is missing (navigation.position) Nov 17 00:02:41 Relexed signalk-server[28812]: 2024-11-16T23:02:41.364Z vhfinfo searchPolygon is null Nov 17 00:02:46 Relexed signalk-server[28812]: 2024-11-16T23:02:46.365Z vhfinfo createSearchPolygon: coordinates info is missing (navigation.position) Nov 17 00:02:46 Relexed signalk-server[28812]: 2024-11-16T23:02:46.366Z vhfinfo searchPolygon is null Nov 17 00:02:51 Relexed signalk-server[28812]: 2024-11-16T23:02:51.366Z vhfinfo createSearchPolygon: coordinates info is missing (navigation.position)

I have no idea how everything works but in the o-charts-log of AvNav it leads tot this:

2024/11/14-15:57:05.084-0x7f4fffec00-INFO-CacheFiller CS_home_pi_avnav_data_ocharts_charts_oeuSENC-BE_NL_UK-2022-2-0-base-sgl001DF950: prefilled for zoom=13: 405 2024/11/14-15:57:05.086-0x7f4fffec00-INFO-CacheFiller CS_home_pi_avnav_data_ocharts_charts_oeuSENC-BE_NL_UK-2022-2-0-base-sgl001DF950: prefilled for zoom=12: 257 2024/11/14-15:57:05.086-0x7f4fffec00-INFO-Cache filler CS_home_pi_avnav_data_ocharts_charts_oeuSENC-BE_NL_UK-2022-2-0-base-sgl001DF950 prefilled 70296 tiles 2024/11/14-15:57:05.086-0x7f4fffec00-INFO-Cache filler finished 2024/11/16-07:01:52.055-0x7f7311fc00-ERROR-read(fd=12): SYSERROR: 104=Connection reset by peer 2024/11/16-07:01:52.058-0x7f7311fc00-ERROR-write(fd=12): SYSERROR: 32=Broken pipe 2024/11/16-07:01:52.058-0x7f7311fc00-ERROR-write(fd=12): SYSERROR: 0=Success 2024/11/16-07:01:52.058-0x7f7311fc00-ERROR-write(fd=12): SYSERROR: 32=Broken pipe 2024/11/16-07:01:52.059-0x7f7311fc00-ERROR-write(fd=12): SYSERROR: 0=Success 2024/11/16-07:01:52.061-0x7f7311fc00-ERROR-write(fd=12): SYSERROR: 32=Broken pipe 2024/11/16-07:01:52.061-0x7f7311fc00-ERROR-write(fd=12): SYSERROR: 0=Success 2024/11/16-07:01:52.062-0x7f7311fc00-ERROR-write(fd=12): SYSERROR: 32=Broken pipe 2024/11/16-07:01:52.062-0x7f7311fc00-ERROR-write(fd=12): SYSERROR: 0=Success 2024/11/16-07:01:52.064-0x7f7311fc00-ERROR-write(fd=12): SYSERROR: 32=Broken pipe 2024/11/16-07:01:52.064-0x7f7311fc00-ERROR-write(fd=12): SYSERROR: 0=Success 2024/11/16-07:01:52.065-0x7f7311fc00-ERROR-write(fd=12): SYSERROR: 32=Broken pipe 2024/11/16-07:01:52.065-0x7f7311fc00-ERROR-write(fd=12): SYSERROR: 0=Success 2024/11/16-07:01:52.067-0x7f7311fc00-ERROR-write(fd=12): SYSERROR: 32=Broken pipe 2024/11/16-07:01:52.067-0x7f7311fc00-ERROR-write(fd=12): SYSERROR: 0=Success 2024/11/16-07:01:52.067-0x7f7311fc00-ERROR-write(fd=12): SYSERROR: 32=Broken pipe 2024/11/16-07:01:52.068-0x7f7311fc00-ERROR-write(fd=12): SYSERROR: 0=Success 2024/11/16-07:01:52.077-0x7f7311fc00-ERROR-GetLocalAddress(fd=12): SYSERROR: 107=Transport endpoint is not connected 2024/11/16-07:01:52.080-0x7f7311fc00-ERROR-write(fd=17): SYSERROR: 32=Broken pipe 2024/11/16-07:01:52.080-0x7f7311fc00-ERROR-write(fd=17): SYSERROR: 0=Success 2024/11/16-07:01:52.081-0x7f7311fc00-ERROR-write(fd=17): SYSERROR: 32=Broken pipe 2024/11/16-07:01:52.081-0x7f7311fc00-ERROR-write(fd=17): SYSERROR: 0=Success

So o-charts stops working after a while and then you have to restart AvNav te get them workinh again (only for a while).

Disabling the VHFInfo plugin in Signalk solves the problem for the o-charts in AvNav

I also notice that when VHFInfo (without GPS signal) is disabled zooming in en out of the charts is much faster!

htool commented 1 week ago

This is what Grok says about it:

When currentCoordinates is null in the provided SignalK plugin code, no positional data is sent to SignalK regarding nearby features because:

  1. Initialization of currentCoordinates:

    • The currentCoordinates variable is set when the app.streambundle.getSelfStream('navigation.position') stream provides a position update. If no position data is received, currentCoordinates remains null.
  2. Impact on Feature Updates:

    • The main functionality for updating and sending nearby features (updateFeatures()) relies on currentCoordinates to define the search polygon (searchPolygon = createSearchPolygon()). If currentCoordinates is null, createSearchPolygon() returns null because it checks:
      if (currentCoordinates == null) {
      app.debug('createSearchPolygon: coordinates info is missing (navigation.position)')
      pluginStatus = 'Starting... waiting for navigation.position'
      return null
      }
  3. Resulting Behavior:

    • When updateFeatures() is called and searchPolygon is null, the function logs that the search polygon is null:

      if (searchPolygon != null) {
      // ... Code to process and find nearby features ...
      } else {
      app.debug('searchPolygon is null')
      }
    • Since featuresInBox would also be empty or not up-to-date due to the lack of currentCoordinates for defining the search area, even if findNearbyFeatures() were to be called, it would not have any relevant data to work with.

  4. Sending Updates:

    • The function sendUpdates() which would actually send data to SignalK is not called because there are no nearby features identified due to the absence of positional data.

Therefore, when currentCoordinates is null, essentially no feature data or positional updates are sent to SignalK for nearby VHF information because:

  • The plugin waits for position data to start processing and sending updates.
  • Without position data, it cannot determine what features are nearby or within a search polygon, thus no data is sent regarding VHF information or nearby features. The only activity would be logging that it's waiting for position data or that the search polygon is null.

I don't see how it would be connected, other than that it logs the problem. Did you try to turn off the debug logging for the vhf plugin?

Fietsenwiel commented 1 week ago

Debug logging was on. Now I set it off and enabled VHFinfo again.

But within 10 minutes o-chars disappears again...

htool commented 1 week ago

I really see no connection between the two. Can you get more debug info from o-chart?

Fietsenwiel commented 1 week ago

Here the log off o-charts when it goes wrong:

2024/11/17-21:52:12.586-0x7f4b7fdc00-INFO-Cache filler starts 2024/11/17-21:52:12.587-0x7f4b7fdc00-INFO-Cache filler finished 2024/11/17-21:52:12.947-0x7fa642f7c0-INFO-closing chart /home/pi/avnav/data/ocharts/charts/oeuSENC-BE_NL_UK-2022- 2024/11/17-21:52:12.982-0x7fa642f7c0-INFO-opening /home/pi/avnav/data/ocharts/charts/oeuSENC-BE_NL_UK-2022-2-0-ba 2024/11/17-21:52:12.987-0x7fa642f7c0-INFO-verifySENC s0: 1 8583 0 0 2024/11/17-21:58:55.499-0x7f6a91ec00-ERROR-write(fd=16): SYSERROR: 32=Broken pipe 2024/11/17-21:58:55.499-0x7f6a91ec00-ERROR-write(fd=16): SYSERROR: 0=Success 2024/11/17-21:58:55.499-0x7f6a91ec00-ERROR-write(fd=16): SYSERROR: 32=Broken pipe 2024/11/17-21:58:55.499-0x7f6a91ec00-ERROR-write(fd=16): SYSERROR: 0=Success 2024/11/17-21:58:55.519-0x7f6a91ec00-ERROR-write(fd=16): SYSERROR: 32=Broken pipe 2024/11/17-21:58:55.519-0x7f6a91ec00-ERROR-write(fd=16): SYSERROR: 0=Success 2024/11/17-21:58:55.520-0x7f6a91ec00-ERROR-write(fd=16): SYSERROR: 32=Broken pipe 2024/11/17-21:58:55.520-0x7f6a91ec00-ERROR-write(fd=16): SYSERROR: 0=Success 2024/11/17-22:03:02.038-0x7f6a91ec00-ERROR-write(fd=16): SYSERROR: 32=Broken pipe 2024/11/17-22:03:02.038-0x7f6a91ec00-ERROR-write(fd=16): SYSERROR: 0=Success 2024/11/17-22:03:02.038-0x7f6a91ec00-ERROR-write(fd=16): SYSERROR: 32=Broken pipe 2024/11/17-22:03:02.038-0x7f6a91ec00-ERROR-write(fd=16): SYSERROR: 0=Success 2024/11/17-22:03:02.063-0x7f6a91ec00-ERROR-write(fd=16): SYSERROR: 32=Broken pipe 2024/11/17-22:03:02.063-0x7f6a91ec00-ERROR-write(fd=16): SYSERROR: 0=Success 2024/11/17-22:03:02.063-0x7f6a91ec00-ERROR-write(fd=16): SYSERROR: 32=Broken pipe 2024/11/17-22:03:02.063-0x7f6a91ec00-ERROR-write(fd=16): SYSERROR: 0=Success

This only happens with VHFinfo enabled (and debug log now off).

htool commented 1 week ago

It's really unclear from those logs why it gets errors. The o-chart plugin is the one with the problem. Try to reach out to them as well.

Fietsenwiel commented 1 week ago

I think it is hard to convince the o-charts pluging developers that the problem is theirs (for me).

Because the o-charts plugin works without any problem without VHFinfo.

If I can provide more info I am happy to do that.

htool commented 1 week ago

Same the other way around. But o-chart is crashing, which it shouldn't do.

Fietsenwiel commented 1 week ago

I already have made an issue there...

htool commented 1 week ago

It's probably useful to include the output of Signalk's Data Browser searching for 'resources.vhfdata'. If OpenCPN trips over the content there, it may explain why it happens. It woulf still be on OpenCPN to not trip over it.

Fietsenwiel commented 1 week ago

I don't use Opencpn but AvNav instead.

Here is the logging of VHFinfo in Signalk (filtered on vhfinfo): Nov 18 15:22:51 2024-11-18T14:22:51.362Z vhfinfo createSearchPolygon: coordinates info is missing (navigation.position) Nov 18 15:22:51 2024-11-18T14:22:51.365Z vhfinfo searchPolygon is null Nov 18 15:22:56 2024-11-18T14:22:56.366Z vhfinfo createSearchPolygon: coordinates info is missing (navigation.position) Nov 18 15:22:56 2024-11-18T14:22:56.368Z vhfinfo searchPolygon is null Nov 18 15:22:59 (node:79077) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 nmea0183 listeners added to [Function]. Use emitter.setMaxListeners() to increase limit Nov 18 15:23:01 2024-11-18T14:23:01.369Z vhfinfo createSearchPolygon: coordinates info is missing (navigation.position) Nov 18 15:23:01 2024-11-18T14:23:01.370Z vhfinfo searchPolygon is null Nov 18 15:23:02 ::1 - - [18/Nov/2024:14:23:02 +0000] "GET /signalk/v1/api/vessels/self HTTP/1.1" 200 3640 "-" "Python-urllib/3.9" Nov 18 15:23:06 2024-11-18T14:23:06.370Z vhfinfo createSearchPolygon: coordinates info is missing (navigation.position) Nov 18 15:23:06 2024-11-18T14:23:06.371Z vhfinfo searchPolygon is null Nov 18 15:23:11 2024-11-18T14:23:11.372Z vhfinfo createSearchPolygon: coordinates info is missing (navigation.position) Nov 18 15:23:11 2024-11-18T14:23:11.373Z vhfinfo searchPolygon is null

I see a memory leak?

At this point O-charts are still working... I expect not anymore after 10 minutes.

Fietsenwiel commented 1 week ago

The Signalk date brouwser shows nothing (yet): No ocharts7

htool commented 1 week ago

The memory leak speaks of NME0183. Vhfinfo doesn´t use that. Looking at AvNav, it does: https://www.wellenvogel.net/software/avnav/docs/hints/CanboatAndSignalk.html?lang=en

Fietsenwiel commented 4 days ago

Ok, thanks. But i have given up. I just stop using VHFinfo. It is not thát important.