fisharebest / webtrees

Online genealogy
https://webtrees.net
GNU General Public License v3.0
463 stars 299 forks source link

Server Throwing Large Number of Version Check Errors #4929

Closed miqrogroove closed 9 months ago

miqrogroove commented 9 months ago

My server is throwing this error about 50 times per minute and the server is now running extremely slow.

Site preference "LATEST_WT_VERSION_ERROR" set to "cURL error 28: Connection timed out after 3000 milliseconds (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://dev.webtrees.net/build/latest-version.txt?w=2.1.18&p=8.3.1&s=[redacted]&d=mysql"

I suspect the UpgradeService is failing to update the version check timestamp when connection errors occur.

miqrogroove commented 9 months ago

Workaround:

Replace the function under app/Services/UpgradeService.php as follows

private function fetchLatestVersion(bool $force): string
{
    return '2.1.18|2.0.0|https://github.com/fisharebest/webtrees/releases/download/2.1.18/webtrees-2.1.18.zip';
}

Then:

mysql> UPDATE site_setting SET setting_value = '' WHERE setting_name = 'LATEST_WT_VERSION_ERROR';
FrankWarius commented 9 months ago

The cause of the problem is that an update check is carried out with every request (click or spider). Only if the attempt is successful LAST_WT_VERSION_TIMESTAMP will be set to the current time and the next query will take place in approximately 24 hours.

I use the following workaround in function fetchLatestVersion:

Old from linme358: } else { Site::setPreference('LATEST_WT_VERSION_ERROR', 'HTTP' . $response->getStatusCode()); } } catch (GuzzleException $ex) { // Can't connect to the server? // Use the existing information about latest versions. Site::setPreference('LATEST_WT_VERSION_ERROR', $ex->getMessage()); } new: } else { Site::setPreference('LATEST_WT_VERSION_ERROR', 'HTTP' . $response->getStatusCode()); Site::setPreference('LATEST_WT_VERSION_TIMESTAMP', (string) $current_timestamp); } } catch (GuzzleException $ex) { // Can't connect to the server? // Use the existing information about latest versions. Site::setPreference('LATEST_WT_VERSION_ERROR', $ex->getMessage()); Site::setPreference('LATEST_WT_VERSION_TIMESTAMP', (string) $current_timestamp); }

The next access to the update server takes place one day later, regardless of whether the access was successful.

mpwt commented 9 months ago

The error message appears in two installations exactly from 27.12.2023 in the webtrees log under "config". Since there were no program changes before that, there seems to be a problem on the update server.

fisharebest commented 9 months ago

there seems to be a problem on the update server.

There was a problem with the update server (the first significant downtime in 10+ years?).

It has now been moved to a new (and more powerful) server and is working again.

@FrankWarius - yes, we need a solution like the one you propose.

miqrogroove commented 9 months ago

To minimize update racing, it would be better to reset the timestamp before waiting for connection errors.