AndyTaylorTweet / Pi-Star_DV_Dash

Pi-Star DV Dashboard (Based on works by Hans-J. Barthen (DL5DI) and Kim Huebel (DG9VH)).
http://www.pistar.uk/downloads/
111 stars 120 forks source link

huge delay when YSFGateway loads/reloads YSF hosts list #95

Closed narspt closed 4 years ago

narspt commented 4 years ago

Hi Andy, Not exactly related to the dashboard (unless you will also want to set ReloadTime differently after reading this, but not the real solution)... there is currently a huge delay when YSFGateway loads/reloads YSF hosts list, this causes two problems: one is the undesired delay itself when YSFGateway starts up and even worst is that you (configure.php) also setup YSFGateway to reload hosts list every hour (ReloadTime=60) and during this reload YSFGateway seems to freeze completely for some time, meaning audio lost and it doesn't even send keep-alive packets to the connected reflector, causing connection drops every hour (most noticeable on new XLXs as they default to 30s YSF keep-alive timeout, instead of 60s of YSFReflector)...

I really guess this delay is caused by DNS resolution of the list host names as the list is increasing more and more and many YSF owners now specify host names instead of IP's... then maybe it's time you do the same you did for D-Star reflectors list: resolve host names on your server from time to time and feed resolved list with just IP's to Pi-Star's?

The log below shows YSFGateway taking 55s to load the YSF hosts list, but I did already see it taking even more than 1min sometimes (causing drop from time to time even on my tests XLX that is tweaked to 60s YSF keep-alive timeout).

M: 2020-02-19 05:48:52.216 Opening YSF network connection
I: 2020-02-19 05:48:52.216 Opening UDP port on 4200
M: 2020-02-19 05:48:52.217 Opening YSF network connection
I: 2020-02-19 05:48:52.217 Opening UDP port on 42000
M: 2020-02-19 05:48:52.217 Resolving FCS00x addresses
M: 2020-02-19 05:48:52.718 Opening FCS network connection
I: 2020-02-19 05:48:52.718 Opening UDP port on 42001
I: 2020-02-19 05:48:52.719 The ID of this repeater is 42620
I: 2020-02-19 05:48:52.721 Loaded 306 FCS room descriptions
E: 2020-02-19 05:49:17.710 Cannot find address for host fusion2.m1axm.co.uk
I: 2020-02-19 05:49:47.428 Loaded 655 YSF reflectors
I: 2020-02-19 05:49:47.428 Loaded YSF parrot
I: 2020-02-19 05:49:47.428 Loaded YSF2DMR
I: 2020-02-19 05:49:47.428 Loaded YSF2NXDN
I: 2020-02-19 05:49:47.428 Loaded YSF2P25
M: 2020-02-19 05:49:47.508 Starting the APRS Writer thread
M: 2020-02-19 05:49:47.508 No connection startup
M: 2020-02-19 05:49:47.508 Starting YSFGateway-20190130_Pi-Star

Thanks!

AndyTaylorTweet commented 4 years ago

There are a couple of solutions here, since we dont currently update the host files without restarting the service - I could choose to set the reload time much higher, without any impact.

But I agree, the best action is likely to be to resolve the name to IP once at the update server and pull in IP's only.

AndyTaylorTweet commented 4 years ago

Modified the YSF_Hosts.txt update process, now pulling the IP only version of the update file, and dropping hosts that are not resolvable to IP address.

That should make YSFGateway start up quickly, and should make a reload of the host file seamless again.

narspt commented 4 years ago

Yes, I think this is the best solution, because changing ReloadTime would not fix the startup delay. Also I remember an old problem, when power outage occurs and is then restored Pi-Star would usually startup faster than my router, this would make YSFGateway fail resolution and be unable to connect to any YSFs with host name on the list until restart, this should also fix this issue :)

I confirm it is very fast now:

M: 2020-02-19 13:38:18.027 Opening YSF network connection
I: 2020-02-19 13:38:18.027 Opening UDP port on 4200
M: 2020-02-19 13:38:18.027 Opening YSF network connection
I: 2020-02-19 13:38:18.027 Opening UDP port on 42000
M: 2020-02-19 13:38:18.027 Resolving FCS00x addresses
M: 2020-02-19 13:38:18.405 Opening FCS network connection
I: 2020-02-19 13:38:18.405 Opening UDP port on 42001
I: 2020-02-19 13:38:18.405 The ID of this repeater is 42620
I: 2020-02-19 13:38:18.408 Loaded 306 FCS room descriptions
I: 2020-02-19 13:38:18.423 Loaded 654 YSF reflectors
I: 2020-02-19 13:38:18.426 Loaded YSF parrot
I: 2020-02-19 13:38:18.426 Loaded YSF2DMR
I: 2020-02-19 13:38:18.426 Loaded YSF2NXDN
I: 2020-02-19 13:38:18.426 Loaded YSF2P25
M: 2020-02-19 13:38:18.519 Starting the APRS Writer thread
M: 2020-02-19 13:38:18.519 No connection startup
M: 2020-02-19 13:38:18.520 Starting YSFGateway-20190130_Pi-Star

Thank you again!

AndyTaylorTweet commented 4 years ago

nice, I'm glad it was quick to fix it :)