Simple Machines Community Forum

SMF Support => Server Performance and Configuration => Topic started by: brabont on March 18, 2019, 07:02:37 AM

Title: Database Error! and blank settings.php
Post by: brabont on March 18, 2019, 07:02:37 AM
Hi!

I kept getting notification from my up-to-date SMF server that connection to database was lost for a few days, but I couldn't find any issue except of that error. Forum worked perfectly, but the error popped up again a few times. Then suddenly error + settings.php and the backup-file were blank. I've tried to use repair_settings.phd without success. Is that error and blankness somehow related?
Title: Re: Database Error! and blank settings.php
Post by: Kindred on March 18, 2019, 07:08:59 AM

it's a bug in the system - sometimes a RACE condition can try to write to the Settings.php file at the exact same time that another write is occurring, resulting in a blank file save.

this was fixed, but apparently, the fix got undone in one of the further updates.
This is officially fixed in 2.1.


if you have a backup of your site files, you can restore the settings.php and settings_bak.php from there....
if not, then take a settings.php from the install archive, put it into your forum directory and use repair_settings.php to set the correct values after that....    repair_settings.php depends on the file being present and having contents... it won't work to repair a blank file
Title: Re: Database Error! and blank settings.php
Post by: Arantor on March 18, 2019, 08:33:14 AM
This was never fixed in 2.0 (the bug that was fixed in 2.0 and later undone is the settings on installation problem)

Once fixed, I’d make your Settings.php file read only.
Title: Re: Database Error! and blank settings.php
Post by: Kindred on March 18, 2019, 09:48:52 AM
oops... my mistake. I thought both had been addressed at one point in the 2.0 branch