Closed logicwonder closed 1 year ago
Also I am suspecting that this error could be a result of a sync issue of users table between PostgreSQL and Mnesia.
Wait, what sync?
It looks like data user for authentication is corrupted in database (at least for that user). You talk about converting from mnesia, what kind of procedure did you use for that? You could see what is stored in authentication tables by executing ejabberd_auth:get_password(<<"username">>, <<"my.domain">>).
inside ejabberdctl debug
console. Does that return something or maybe just empty data?
@licaon-kter I thought when an account is created, the user credentials are written SQL DB and Mnesia RAM DB. I think the usage of word "sync" was not correct.
@prefiks I did not do any migration from Mnesia. The users were created using eJabberd HTTP API and PostgreSQL is used as backend SQL DB. The SQL database was was timing out and users started getting the invalid username and password error. The scram error was also seen in the error.log I compared some of the account passwords from SQL DB with the one returned in the Mnesia query. I was unable to find any accounts with a mismatch. So does that mean that when the database is not accessible the above crash is possible and could have resulted in the error?
I am confused about my understanding of auth module.
@logicwonder do get a https://gist.github.com with the (sanitized) config .yml
Here is my config https://gist.github.com/logicwonder/bb7923007e16783ebf2ac22ab914be9f
@logicwonder "DB server got busy and all eJabberd query requests ( started timing out)", Have you examined the database logs during that period? When the DB server becomes busy, does it mean it becomes unresponsive?
If that's the case, the root of the issue likely lies with the database. This situation arises when we're concurrently performing both write and read operations on the same table during peak loads. Due to locking, the database fails to respond and the session count drops to zero.
I encountered a similar problem and resolved it by scaling the database. I separated read and write operations by implementing read and write replicas, and I also introduced a database router by modifying the MySQL driver. This issue isn't specific to ejabberd; it's fundamentally a database performance matter."
Thanks for your assessment and suggestion. Yes it's clear that there was a performance issue in scaling the DB. However Invalid username and password is a misleading error response in such cases. Server busy or timeout errors could make more sense.
Environment
Errors from error.log
Bug description
I have recently faced a PostgreSQL database outage where the DB server got busy and all eJabberd query requests ( started timing out. During this period, I have observed that a large number of authentication requests were responded with "SCRAM-SHA-1 authentication. Invalid username or password." error. The error message in this case could have been different for e.g. "Authentication service unavailable".
Also I am suspecting that this error could be a result of a sync issue of users table between PostgreSQL and Mnesia.
Please guide me for a better understanding on what could have happened.