Open vietnguyen87 opened 1 month ago
First of all, you didn't show your full configuration file, maybe some other parts of it are relevant. For example, remember that ejabberd by default stores persistent data in its internal Mnesia database
Did you setup db_type mod_muc option ?
modules:
mod_muc:
db_type: sql
Or did you setup the toplevel default_db option ?
default_db: sql
Sometime i get an error "Room already exists"
Sometimes you get that error, the room exists, but the room is not stored in MySQL database?
Maybe the room existed before you create it?
And what happens other times? Other times the room didn't exist first, you run the API and you don't get that error, the room is created correctly, and the room is stored correctly in the MySQL database?
I tried ejabberd 24.02 with your configuration, tried your query, and it works correctly. Of course, I only tried a few times, maybe the problem appears with many many requests...
ejabberd version: 24.2.40
Please try with ejabberd 24.7, as it includes some fixes in the create_room_with_opts API: https://github.com/processone/ejabberd/commit/06675e4fb2b05a6d2d2b63ae26492b60286dc80e
Thanks @badlop,
sorry, let me update ejabberd version: 24.2.0
I has updated full configuration.
Or did you setup the toplevel default_db option ?
I has configured default_db: "sql"
already. And not configured yet.
modules:
mod_muc:
db_type: sql
And what happens other times? Other times the room didn't exist first, you run the API and you don't get that error, the room is created correctly, and the room is stored correctly in the MySQL database?
Yes, the room is created correctly and saved to MySQL. Sometime i get an error "Room already exists" although it was not existed before.
It's not too much request. I just work on my testing environment with fews request / second.
By the way I have a question. I don't have mod_offline configured at the moment. However, users still receive the messages when they are back to online.
let me update ejabberd version: 24.2.0
Once you update to ejabberd 24.7, let's see if the problem gets solved.
I has configured default_db: "sql" already.
Aha, then all modules will try to use sql for their persistent storage, including mod_muc. No need to configure db_type.
I just work on my testing environment with fews request / second.
Maybe you accidentally call the API two times to create the same room? Or maybe the API client fails and sends again the same query? Check the ejabberd logs for recent API calls...
I don't have mod_offline configured at the moment. However, users still receive the messages when they are back to online.
That is rare. Maybe the module is enabled in some of the included config files?
Or maybe the module is not really enabled, and users just get some other messages from MAM storage (which is different to Offline storage). When a user sends a message to an offline user, in what SQL table is the message stored: in spool (using mod_offline) or in archive (using mod_mam)?
Hi @badlop,
. That is rare. Maybe the module is enabled in some of the included config files?
How can i check it?
. Or maybe the module is not really enabled, and users just get some other messages from MAM storage (which is different to Offline storage). When a user sends a message to an offline user, in what SQL table is the message stored: in spool (using mod_offline) or in archive (using mod_mam)?
both of them (spool and archive tables) are storing the messages.
ejabberd first reads its configuration file ejabberd.yml
.
If that file contains the option include_config_file, then those additional files are read.
Additionally, if there are contribution modules installed, it reads their configuration files, see step 5. of Basic Usage
The question now is, how to know in your specific server what are the options being used, and what files are being read by ejabberd?
This commands dumps the consolidated options that are really being used by ejabberd:
$ ejabberdctl dump_config /tmp/ejabberd.yml
Now view /tmp/ejabberd.yml
, is mod_offline enabled?
You said that you don't have mod_offline enabled in your configuration file, then... why is mod_offline enabled in ejabberd? Maybe ejabberd reads other configuration file, or some additional files that enabled it.
Let's see what configuration files are read by ejabberd. Open an interactive erlang shell attached to your ejabberd node, so you can execute erlang functions and get their result. This is an example in my test server:
$ ejabberdctl debug
...
(ejabberd@localhost)1> ejabberd_config:path().
<<"_build/relive/conf/ejabberd.yml">>
(ejabberd@localhost)2> ext_mod:config_dir().
"/home/badlop/.ejabberd-modules/conf"
(ejabberd@localhost)3> ext_mod:modules_configs().
[<<"/home/badlop/.ejabberd-modules/mod_webadmin_config/conf/mod_webadmin_config.yml">>]
Now check all those files. Does any of those files enable mod_offline?
Alternatively to the previous methods, you can install mod_webadmin_config. That module adds a page to ejabberd's WebAdmin that shows the configuration files that are read and also shows the options being used.
Environment
ejabberd version: 24.2.40 Using the ejabberd/ecs docker container
Configuration
Bug Description
I call Admin Api: https://docs.ejabberd.im/developer/ejabberd-api/admin-api/#create_room_with_opts
Sometime i get an error
"Room already exists"
I can see it created by command
ejabberdctl get_room_options order_53772 conference.localhost
but it not getting saved in muc_room and muc_room_subscribers tables in mysql.
Please help. Thanks.!