An unexpected database error occurred. Please try again later.

CoinBit

Member
Hi. I upgraded the Xenforo from 2.2 to 2.3 and it's giving me this error.

An unexpected database error occurred. Please try again later.

upon checking the source code it says

<!-- User &#039;u811976095_maghrib_pk1607&#039; has exceeded the &#039;max_user_connections&#039; resource (current value: 100) -->

The website works sometimes and then down again. I was out and it stopped working again and haven't come online since 2 hours. The upgraded is very buggy as it destroyed all my skins and probably playing with the add-ons. I have changed the default skin to Xenforo's original and turned off most of the add-ons and was hopefully it is fixed. Any advice will be helpful.

I also checked for years my resources used at the host were not exceeding 8-10% but now suddenly its throwing errors like the following.

Thank you


Resources Usage _ Hostinger.webp
 
Is there any command I can add to turn them off from through the config file?
Not exactly, unless you have a default style set up and know its ID.

Without more insight into what may be causing the database to exceed the maximum connections, it's difficult to narrow anything down. The statistics alone don't indicate which processes are eating the CPU or why. Barring a DDoS, the only other guess I could make is a misbehaving job. It may be worth checking the contents of the xf_job table.

It's also worth checking for new entries to the xf_error_log table.
 
Not exactly, unless you have a default style set up and know its ID.

Without more insight into what may be causing the database to exceed the maximum connections, it's difficult to narrow anything down. The statistics alone don't indicate which processes are eating the CPU or why. Barring a DDoS, the only other guess I could make is a misbehaving job. It may be worth checking the contents of the xf_job table.

It's also worth checking for new entries to the xf_error_log table.
I have a default-style setup right now. Not sure about the ID but it was never deleted so it must be 1. Yesterday I turned the other style ON because it wasn't showing any bugs and the website was still running with 5% resources used.
 
So I asked the host to restore the website

She tried to restore it to 2 days ago. Now I receive this error

The site is currently being upgraded. Please check back later.

but I can login through this link

But I can login through the .com/forums/install link.

and then I gives this error

An exception occurred: [XF\Db\InvalidQueryException] MySQL statement prepare error [1142]: INSERT, UPDATE command denied to user 'u811976095_database_name'@'localhost' for table u811976095_database_name.xf_session_install in src/XF/Db/AbstractStatement.php on line 230

  1. XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 198
  2. XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 40
  3. XF\Db\Mysqli\Statement->prepare() in src/XF/Db/Mysqli/Statement.php at line 56
  4. XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 96
  5. XF\Db\AbstractAdapter->query() in src/XF/Session/DbStorage.php at line 48
  6. XF\Session\DbStorage->writeSession() in src/XF/Session/Session.php at line 221
  7. XF\Session\Session->save() in src/XF/Install/App.php at line 190
  8. XF\Install\App->complete() in src/XF/App.php at line 2488
  9. XF\App->run() in src/XF.php at line 524
  10. XF::runApp() in install/index.php at line 14
any idea?
 
The configured database credentials do not have write access to the xf_session_install table at a minimum, which is a host/server configuration issue.
 
The configured database credentials do not have write access to the xf_session_install table at a minimum, which is a host/server configuration issue.
I was advised by a very known developer of this forum to request the host to restore it prior to the date of upgrade.

They tried and the CPU usage quickly shot up again from 1% to 100% as soon as the restore was complete. So I am guessing it was after the time of upgrade so I have requested them to restore again to 5 days ago even though the upgrade was done on Monday.

Let's see what happens this time and I will keep you updated
 
This is just me guessing, but something similar happened with my wiki a while back where:
  • There was a bug/compatibility issues with my wiki and the PHP version I was using
  • Every time the wiki loaded a page, this bug caused an error message
  • These messages were being logged
  • The need to update the log file hundreds of times a second was slowing the entire server down and maxing resources
  • Eventually the site went offline because it ran out of space, due to the error log being like 160 GB of errors due to this one bug
I think something similar is happening to you:
  • You updated to 2.3
  • The screenshot you showed says there's a template error so maybe your style is not compatible?
  • Every time your site is loaded it makes more errors
  • These errors are logged in your database many times a second, which increases its size and slows it down, creating issues connecting to it because of all the traffic between the forum and the database
I think you should immediately switch to the default Xenforo style as your main style and disable the one causing the template issues until it gets an update. See if that helps.
 
This is just me guessing, but something similar happened with my wiki a while back where:
  • There was a bug/compatibility issues with my wiki and the PHP version I was using
  • Every time the wiki loaded a page, this bug caused an error message
  • These messages were being logged
  • The need to update the log file hundreds of times a second was slowing the entire server down and maxing resources
  • Eventually the site went offline because it ran out of space, due to the error log being like 160 GB of errors due to this one bug
I think something similar is happening to you:
  • You updated to 2.3
  • The screenshot you showed says there's a template error so maybe your style is not compatible?
  • Every time your site is loaded it makes more errors
  • These errors are logged in your database many times a second, which increases its size and slows it down, creating issues connecting to it because of all the traffic between the forum and the database
I think you should immediately switch to the default Xenforo style as your main style and disable the one causing the template issues until it gets an update. See if that helps.
The default skin is the original skin of Xenforo right now.

However I did turn one of the style ON once again. It means some users may have selected it from their preferences and can cause this problem. I am trying to restore the site to 5 days ago - if it doesn't work I will be able to reply tomorrow morning.

I wish there was easier way to disable all the styles so that the default style was automatically selected
 
The default skin is the original skin of Xenforo right now.

However I did turn one of the style ON once again. It means some users may have selected it from their preferences and can cause this problem. I am trying to restore the site to 5 days ago - if it doesn't work I will be able to reply tomorrow morning.

I wish there was easier way to disable all the styles so that the default style was automatically selected
what happens if i delete the styles from the file manager/ftp?
 
I think the best way to do it is from the ACP, not the files.

It's possible to run a command in phpMyAdmin that puts all users on the default style.
 
Last edited:
The styles are not stored (solely) on the file system and deleting data haphazardly from the file system or database is only likely to exacerbate problems. The server issues will need to be identified and sorted out first. Style issues on their own should never cause issues accessing the control panel, and once the control panel is accessible it is easy to manage and disable styles.

A competent host should be able to narrow in on the cause of issues beyond just pointing out the CPU is hammered.
 
The styles are not stored on the file system and deleting data haphazardly from the file system and database is only likely to exacerbate problems. The server issues will need to be identified and sorted out first. Style issues on their own should never cause issues accessing the control panel, and once the control panel is accessible it is easy to manage and disable styles.

A competent host should be able to narrow in on the cause of issues beyond just pointing out the CPU is hammered.
Still, would you say that changing user_selectable to 0 for the non-default styles in table xf_style is worth trying if these template issues are caused by an incompatible style?

@CoinBit let's so a status check:
  1. Is your forum actually running right now?
  2. Can you access the forum's Admin Panel now?
  3. This could be happening because of an incompatible add-on that doesn't play nice with 2.3. If you can't access the ACP, did you try disabling addons? To do this, add
    Code:
    $config['enableListeners'] = false;
    to src/config.php
  4. If you can access the ACP you may want to clear the error log to address the giant database issue if you haven't already solved this with the backup-restore you mentioned earlier (maybe save some examples first)
 
Still, would you say that changing user_selectable to 0 for the non-default styles in table xf_style is worth trying if these template issues are caused by an incompatible style?

@CoinBit let's so a status check:
  1. Is your forum actually running right now?
  2. Can you access the forum's Admin Panel now?
  3. This could be happening because of an incompatible add-on that doesn't play nice with 2.3. If you can't access the ACP, did you try disabling addons? To do this, add
    Code:
    $config['enableListeners'] = false;
    to src/config.php
  4. If you can access the ACP you may want to clear the error log to address the giant database issue if you haven't already solved this with the backup-restore you mentioned earlier (maybe save some examples first)
I can't access anything. I have used the eventlistener and it worked yesterday but not anymore. The host provider tried to restore the website to 5 days ago when it was at 2.2. So I am not sure what version I will have there after this restoration process as the restore did not work.

I think it could be because of the style because it was ON on both occasions when it happened 2 days ago and today once again
 
Still, would you say that changing user_selectable to 0 for the non-default styles in table xf_style is worth trying if these template issues are caused by an incompatible style?
The template errors are likely the result of style incompatibilities or outdated templates, but that alone is unlikely to cause the kinds of issues that would prevent you from merely logging into the control panel and disabling them. The larger issues here should be tackled first.
 
In your place I would install XF 2.3 locally, I would import the latest backup of the database and try to resolve the problem so, locally you will have all the latitude to work on the database, files, etc. without any risk.
 
So my server was moved to different location, cloudlfare enabled, all add-ons deleted, all styles deleted. So it has a stock Xenforo but still I am getting errors in the server log. Most of these errors are connection related but some other errors also exists.

There were no errors for about 8-10 hours and then suddenly I noticed 12,000 errors. I cleared them up and then I noticed another 12,000 errors.

connection.webp
 
That's a server limitation.

Find a new host.
but until last week I had an average of 400 guests and 60-120 members at a given time. There was never an issue for it as I have an average of 1500-2000 posts per day on the forum. It started happening more often now after the server was moved to a different location I reckon?

Maybe I should speak to the host?
 
Back
Top Bottom