@marcozambi I didn’t delete the VM I did this in so I was able to get the info for my fix.
The first thing I did was modify smf2.rb. I changed the create_db_connection method to the following:
def create_db_connection
Mysql2::Client.new(
host: options.host,
username: options.username,
password: options.password,
database: options.database,
read_timeout: 10000,
write_timeout: 10000,
connect_timeout: 10000,
reconnect: true
)
end
Next, I installed MariaDB in place of MySQL. I’m not sure if this step was necessary, it was just one thing I tried while troubleshooting. I’m including it because I think some of the variables in the next step are exclusive to MariaDB, and I’m not exactly sure which setting actually solved the problem. I just went through and found all the settings dealing with timeouts, # of connections, packet size, etc. and set them at the maximum values.
Here’s a guide for replacing MySQL with MariaDB:
You’ll have to import your SMF database to MariaDB after you get it setup.
Finally, add the following to the end of the /etc/mysql/conf.d/mariadb.cnf configuration file:
max_allowed_packet=1073741824
connect_timeout=5000
max_connections=10000
max_length_for_sort_data=8388608
max_sort_length=8388608
net_read_timeout=10000
net_write_timeout=10000
net_retry_count=1000
net_buffer_length=1073741824
I believe one of these settings in the last step is what resolved it.
I think this solution will work better than the other suggestion because it makes it so the connection is never lost, as opposed to retrying the connection when it is lost.