-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Init()'ing mysql databases can crash due to broken logging #266
Comments
Is this still an issue in the latest version? |
Yes. It happens to me on Etherpad Lite 1.9.3 as well. The issue is comes from this line:
The issue is that default value for I think this is some mismatch in expected API for logger. |
@mitar So I just need to start Etherpad with a MySQL database and get this error? |
@SamTV12345 Yes, but charset/collation has to be See also: YunoHost-Apps/etherpad_mypads_ynh#172 |
Hm. I can't even get it to work with MySQL. I get this error: [2023-10-11 21:23:03.581] [ERROR] ueberDB - Fatal MySQL error: Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'etherpaduser'@'192.168.65.1' (using password: YES) This is my settings json: "dbType" : "mysql",
"dbSettings" : {
"user": "etherpaduser",
"host": "localhost",
"port": 3306,
"password": "password",
"database": "etherpad_lite_db",
"charset": "utf8mb4"
}, and my docker compose: version: '3'
services:
db:
image: mysql
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_USER: ueberdb
MYSQL_PASSWORD: ueberdb
MYSQL_DATABASE: ueberdb |
Hm, your |
I forgot to mention. The issue is resolved on the develop tag. |
We observed this when upgrading from etherpad-lite 1.8.17 to 1.8.18 which updated ueberdb2 from 1.4.18 to 2.2.4. While there is a small chance the issue is in etherpad-lite I strongly suspect euberdb2 and 7a35238 in particular.
When starting etherpad-lite euberDB creates the
store
table in the database if it doesn't exist, then it checks the charset and collation for the databse and finally the charset and collation for thestore
table. If the charset is notutf8mb4
and collation notutf8mb4_something
then ueberdb logs this message:ueberDB - Database is not configured with charset utf8mb4 -- This may lead to crashes when certain characters are pasted in pads
(this is from https://github.com/ether/ueberDB/blob/v2.2.4/databases/mysql_db.js#L76-L77). The problem is what happens next: it tries to log the results of the query for the charset info and then crashes as undefined objects don't have a 'level' property (this happens at https://github.com/ether/ueberDB/blob/v2.2.4/databases/mysql_db.js#L78).This is what the logs look like from etherpad-lite that illustrate this sequence of events:
Our
etherpad-lite
database had default charset and collation set toutf8
which triggers theyou aren't set to utf8mb4
path, but on etherpad-lite 1.8.17 with older euberdb this wasn't fatal because we logged it and moved on. The etherpad service itself was happy in that situation because thestore
table correctly set its charset and collation to the desired values. To work around this problem we altered theetherpad-lite
database default charset toutf8mb4
and collation toutf8mb4_bin
.On the eulerdb side of things it should be able to log properly when this problem occurs even if the end result is that etherpad chooses to fail and exit. Additionally, setting these defaults at the database level only appears to affect
CREATE TABLE
,LOAD DATA
, and stored routines in MySQL if they don't explcitly set the charset and collation method. It may not be super important to fail on anyway?I've just written a lot of words to say I think that logging can crash in the mysql driver causing everything to fail. I'm not entirely sure why though the above commit is suspicious purely due to it touching logging and merging recently.
The text was updated successfully, but these errors were encountered: