Hi,it is not a problem of the sqlite file:sqlite> .schema userpush
CREATE TABLE userpush (
key_name TEXT,
"key_type" INTEGER,
value_type INTEGER,
key_value TEXT
);
sqlite> insert into userpush ('key_name') values ('test');
sqlite> select * from userpush;
test|||
sqlite>And the file itself has 666 as rights, so everyone is allowed to write to it. (at the moment)Von: "Henning Westerholt" <hw@gilawa.com>
An: "Kamailio" <sr-users@lists.kamailio.org>
CC: "Bernd Krueger-Knauber" <bkk@ednt.de>
Gesendet: Dienstag, 18. Juli 2023 11:30:43
Betreff: RE: [SR-Users] Kamailio 5.6.4 and htable dbmode=1__________________________________________________________Hello,
ERROR: db_sqlite [dbase.c:528]: db_sqlite_commit(): sqlite commit failed: attempt to write a readonly database
ERROR: db_sqlite [dbase.c:177]: db_sqlite_cleanup_query(): finalize failed: attempt to write a readonly database
ERROR: htable [ht_db.c:668]: ht_db_delete_records(): failed to delete db records in [userpush]
ERROR: db_sqlite [dbase.c:528]: db_sqlite_commit(): sqlite commit failed: attempt to write a readonly database
This looks that the error is not on the Kamailio side, but your database is somehow not working correctly.
Have you tried to open the database with the sqlite command line shell and execute an INSERT or similar? If it also fails, there must be something wrong on the DB side.
Cheers,
Henning
From: Bernd Krueger-Knauber <bkk@ednt.de>
Sent: Montag, 17. Juli 2023 12:42
To: sr-users@lists.kamailio.org
Subject: [SR-Users] Kamailio 5.6.4 and htable dbmode=1
Hi Daniel,
thank you for your response.
As you can see in the provided debug output:
kamailio[]: DEBUG: htable [ht_api.c:1046]: ht_table_spec(): htable[callpush] - dbmode [1]kamailio[]: DEBUG: htable [ht_api.c:1027]: ht_table_spec(): htable[callpush] - dbtable [userpush]kamailio[]: DEBUG: htable [ht_api.c:1036]: ht_table_spec(): htable[callpush] - expire [86400]kamailio[]: DEBUG: htable [ht_api.c:1041]: ht_table_spec(): htable[callpush] - size [10]dbmode is set to 1 in the config:modparam("htable", "db_url", "sqlite:////etc/kamailio/htable.sqlite")...modparam("htable", "htable", "userpush=>size=3;autoexpire=600;dbtable=userpush;dbmode=1")If I executekamcmd htable.store userpush
I get
Ok. Htable successfully stored to DB.
But the table is still empty!!!
In the log I found:
ERROR: db_sqlite [dbase.c:528]: db_sqlite_commit(): sqlite commit failed: attempt to write a readonly database
ERROR: db_sqlite [dbase.c:177]: db_sqlite_cleanup_query(): finalize failed: attempt to write a readonly database
ERROR: htable [ht_db.c:668]: ht_db_delete_records(): failed to delete db records in [userpush]
ERROR: db_sqlite [dbase.c:528]: db_sqlite_commit(): sqlite commit failed: attempt to write a readonly database
Ok.
But I can not see this entries if I shutdown kamailio.
And:
-rw-rw-rw- 1 kamailio root 16384 Jul 13 16:14 htable.sqlite
I never used:modparam("db_sqlite","db_set_readonly" ...
I also restarted kamailio. no difference.
Now more errors then before:
It is not written at shutdown. (no messages)
It is not written (live) (with error messages, but why it is readonly?)
The message of kamcmd is wrong (says Ok but it failed)
Best regards,
Bernd
Am 17.07.2023 um 08:48 schrieb Daniel-Constantin Mierla:Hello,is dbmode=1 in htable definition?If you run rpc command htable.store for the htable, are the recordssaved to database?Cheers,DanielOn 13.07.23 17:45, Bernd Krueger-Knauber wrote:Hi,I just tried to use sqlite and htable to load and save the values.At start I can see in the log, that all parameters are correct andthat htable want to load the values from the table.No errors.But if I stop kamailio, nothing is written to the tables.At start I can see:kamailio[]: DEBUG: <core> [core/modparam.c:112]:set_mod_param_regex(): 'htable' matches module 'htable'kamailio[]: DEBUG: <core> [core/sr_module.c:814]: find_param_export():found <htable> in module htable[/usr/lib/x86_64-linux-gnu/kamailio/modules/htable.so]kamailio[]: DEBUG: <core> [core/modparam.c:128]:set_mod_param_regex(): found <htable> in module htable[/usr/lib/x86_64-linux-gnu/kamailio/modules/htable.so]kamailio[]: DEBUG: htable [ht_api.c:1046]: ht_table_spec(): htable[callpush] - dbmode [1]kamailio[]: DEBUG: htable [ht_api.c:1027]: ht_table_spec(): htable[callpush] - dbtable [userpush]kamailio[]: DEBUG: htable [ht_api.c:1036]: ht_table_spec(): htable[callpush] - expire [86400]kamailio[]: DEBUG: htable [ht_api.c:1041]: ht_table_spec(): htable[callpush] - size [10]kamailio[]: DEBUG: htable [ht_api.c:1084]: ht_db_load_tables():loading db table [userpush] in ht [userpush]kamailio[]: DEBUG: htable [ht_db.c:232]: ht_db_load_table():=============== loading hash table [userpush] from database [userpush]kamailio[]: DEBUG: db_sqlite [dbase.c:223]: db_sqlite_submit_query():submit_query: select key_name,key_type,value_type,key_value fromuserpush order by key_namekamailio[]: DEBUG: <core> [db_query.c:72]: db_do_submit_query():submitted query: select key_name,key_type,value_type,key_value fromuserpush order by key_name, result 0kamailio[]: DEBUG: <core> [db_res.c:119]: db_new_result(): allocate 56bytes for result set at 0x7f4882107938kamailio[]: DEBUG: <core> [db_res.c:79]: db_free_columns(): freeing 0columnskamailio[]: DEBUG: <core> [db_res.c:138]: db_free_result(): freeingresult set at 0x7f4882107938Ok, the file is empty, but it tries to load the data from the table.The table looks like:sqlite> .schema userpushCREATE TABLE userpush (key_name TEXT,"key_type" INTEGER,value_type INTEGER,key_value TEXT);I checked the source code and I saw that destroy() should be called.Inside is ht_db_open_con() called before ht_db_sync_tables(), were ithappens.But I can even not see the debug message from ht_db_open_con() :LM_DBG("database connection opened successfully\n")and also notLM_ERR("failed to connect to the database\n");For me it looks like, that the destroy() function is not called.Even with debug=3, I can only see:systemd[]: Stopping kamailio.service - Kamailio - the Open Source SIPServer...kamailio[]: INFO: <core> [main.c:854]: sig_usr(): signal 15 receivedsystemd[]: kamailio.service: Deactivated successfully.systemd[]: Stopped kamailio.service - Kamailio - the Open Source SIPServer.I stopped kamailio withsystemctl stop kamailioI'm sure that something was inside the htable before I stoped kamailio:{entry: 0size: 1slot: {{name:07db580a6c13e798a5acc0d123d6e957897c8650b43f99d6d5cb9c2cb5ba4fa4value:3a28dcb73eb65722df5a261983b7692cecdca482bf8725032e46a0c6b89fb355type: str}}}Any further ideas?Best regards,Bernd__________________________________________________________Kamailio - Users Mailing List - Non Commercial DiscussionsTo unsubscribe send an email to sr-users-leave@lists.kamailio.orgImportant: keep the mailing list in the recipients, do not reply onlyto the sender!Edit mailing list options or unsubscribe:
--EDNT GmbHWerner-von-Siemens-Strasse 764625 Bensheimwww.ednt.deRegistergericht: DarmstadtRegisternummer: 24972Geschäftsführer: Karlheinz Knapp
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe: