[500 Error] Uncaught PHP Exception mysqli_sql_exception: "COLLATION 'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'utf8mb3'"

Hy there,

Ok so I have a f*ed up situation here.
My SuiteCRM was working just fine, it’s installed on a server (almalinux 9) that has suite and a wordpress website, nothing else.
Database Server is not the same machine, is a dedicated mariadb cluster with maxscale on front.

So everything was working fine, my DB is utf8mb4_unicode_ci, was working like a charm.

Yesterday I performed an update on the underlying hypervisor and had to reboot them … so I did … simple systemctl poweroff on this VM + systemctl reboot on the hypervisor. There are several hypervisors, several web servers, most (not all) connected to the same database cluster.

Upon it coming back up, EVERYTHING is working BUT SuiteCRM.

When I check SuiteCRM’s logs I have this:

[2023-10-13 10:16:45] request.CRITICAL: Uncaught PHP Exception mysqli_sql_exception: "COLLATION
'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'utf8mb3'" at
/var/www/develop/public_html/sales/public/legacy/include/database/MysqliManager.php line 360
{"exception":"[object] (mysqli_sql_exception(code: 1253): COLLATION 'utf8mb4_unicode_ci' is not valid
for CHARACTER SET 'utf8mb3' at
/var/www/develop/sales/public/legacy/include/database/MysqliManager.php:360)"} []

What utf8mb3 what ? Thanks

from public/legacy/config.php

unrelated

As it was, not changed.

Do you have anything overriding that in config_override.php?

Was just checking config_override.php it has a setting for collation but it is exactly the same.

unrelated

EDIT: the log showing the error is logs/prod/prod.log not public/legacy/suitecrm.log btw dunno if this makes any difference.

That’s a Symfony error, maybe there’s something in your .env.* files?

I just ran egrep against the suitecrm folder and have zero utf8mb3 references except on the logs.

.env

unrelated

.env.local

unrelated

EDIT: also ran a search on the database data from all tables and no occurrence of utf8mb3.

Just to add the results of grep

looking for utf8mb3 returns nothing

[root@develop sales]# egrep -rni --exclude='*.log' utf8mb3 .
[root@develop sales]#

And for utf8mb4

unrelated

Ran another search to find all ‘utf8’ occurrences

unrelated

Aside from this folder I only find a match in the vendor folder. Not sure why cache shows utf8_general_ci where does it get it from??

Also line 2:

unrelated

Some of those values can simply defaults, not configured by SuiteCRM anywhere.

Can you hook up a debugger and see where the code is getting the values from?

It’s intriguing how a reboot can cause this…

@pgr tell me about it, didn’t touch Suite yesterday as I had other duties to attend … actually do today as well… stuck with this now :sob:

Mind telling how to hook the debugger? Cheers.

There are many tutorials online. You have to set up XDEBUG in your php.ini, and use some IDE such as PhpStorm, Visual Studio, Eclipse, VS Code…

If your IDE lives in a different computer than your server, then you also have to get some way of sharing the source directories between the two places.

It will take you a while to get things going, but it’s a total game-changer in terms of SuiteCRM development speed and quality. You also learn SuiteCRM a lot faster because you see how the internals work.

well I’m not a developer but sysadmin, eventually I can set that up but it’ll take some time. debugging apps is not something I do in my day to day :slight_smile:
I use Sublime Text for what’s needed.

By the way, after some looking around I found this - well, re-found actually cause I had been over this somewhen.
I am starting to imagine the reboot didn’t actually affect the web server where SuiteCRM resides, but a setting that had already been changed long ago and now apparently reverted to the original value (from MariaDB 10.6 onwards).

It’s a variable called old_mode

mysql> show variables like 'old_mode';
+---------------+-----------------+
| Variable_name | Value           |
+---------------+-----------------+
| old_mode      | UTF8_IS_UTF8MB3 |
+---------------+-----------------+
1 row in set (0.03 sec)

mysql> 

If I remember correctly this setting has to be empty (value) in order for it to go utf8mb4.

Also checking mariadb docs

UTF8_IS_UTF8MB3

From MariaDB 10.6.1, the main name of the previous 3 byte utf character set has been changed to utf8mb3. If set, the default, utf8 is an alias for utf8mb3. If not set, utf8 would be an alias for utf8mb4.

So anyway I’m going to enforce this on the nodes mariadb server settings - so I can powercycle the nodes and don’t get back to this again - and see if it solves (I’m pretty sure it will), I’ll get back with some feedback in a few moments.

2 Likes
mysql> show variables like 'old_mode';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| old_mode      |       |
+---------------+-------+
1 row in set (0.02 sec)

mysql> 

had to add
old_mode = ""

to all nodes configuration. After restarting the mariadb service on all, confirmed the value was empty, SuiteCRM working again 100%.

Thanks for your time @pgr !

1 Like