agent status after FS upgrade [ERR] switch_core_sqldb.c NATIVE SQL ERR unable to open database file

I had working setup of FusionPBX on Debian 8 jessie. I updated freeswitch packages at Jun 23 2017. After that I discovered FusionPBX can't update registered agents status, so FusionPBX can't forward calls from queue to registered agent:

2017-07-18 10:09:30.024419 [WARNING] sofia_reg.c:1792 SIP auth challenge (REGISTER) on sofia profile 'internal' for [260@domain.my] from ip 10.10.1.5
2017-07-18 10:11:01.524419 [ERR] switch_core_sqldb.c:587 NATIVE SQL ERR [unable to open database file]

freeswitch@server1> show registrations
reg_user,realm,token,url,expires,network_ip,network_port,network_proto,hostname,metadata
260,domain.my,4eagr1EcI6D2qM06nLqBaw..,sofia/internal/sip:260@10.40.1.5:34072;rinstance=daf4c450a7d0be02;transport=tcp;fs_nat=yes;fs_path=sip%3A260%4010.40.1.5%3A58203%3Brinstance%3Ddaf4c450a7d0be02%3Btransport%3Dtcp,1500351030,10.40.1.5,58203,tcp,server1

I upgraded FusionPBX several times but it's not solved this issue. PostgreSQL is working, FusionPBX has access to database. Which database files FusionPBX can't open and how can I fix this issue?
 
Last edited:
Thanks for advice. After upgrade I found owner of some folders in /var/lib/freeswitch changed to freeswitch. I changed owner to www-data and restarted freeswitch without deleting files in /var/lib/freeswitch/db. Now it's working. Why freeswitch doesn't write to log which file it can't access or write?

I moved /var/lib/freeswitch to big partition and made simlink to new place as /var/lib/freeswitch. Maybe it was a reason why owner of new directories changed to freeswitch.

I defined /dev/shm/freeswitch and /dev/shm/freeswitch/db owned by ww-data user in /etc/tmpfiles.d/freeswitch.conf:

d /dev/shm/freeswitch 0750 www-data www-data
d /dev/shm/freeswitch/db 0750 www-data www-data

and created this directories by "systemd-tmpfiles --create". After that I changed value "db" in Advanced - "Default Setting" of FusuonPBX for Switch sections to /dev/shm/freeswitch/db. But FusionPBX and Freeswitch still writes sqlite db files to old /var/lib/freeswitch/db directory. I restarted freeswitch but it still write sqlite db files to old directory. Is it right place to define db dirs?
 

DigitalDaz

Administrator
Staff member
All sounds a bit complex to me but if you had left files in their default locations, after upgrade you can run the installers permissions script and it will set them all right for you.

I only ever stick the freeswitch dbs into tmpfs and I just do that by putting the following in /etc/ftsab:

Code:
tmpfs /var/lib/freeswitch/db tmpfs defaults 0 0
 
hello to everyone.
I'm running ASTPP 4.0.1 with freeswitch 1.6.20~64bit.

with a concurrent calls volume around 70 no problem happens. When calls start to be consistently around 200 calls, freeswitch completely stop to works with following error:

2020-01-14 18:22:58.014930 [ERR] switch_core_sqldb.c:587 NATIVE SQL ERR [unable to open database file]
2020-01-14 18:22:58.014930 [DEBUG] switch_cpp.cpp:1365 [ASTPP] [GET_OVERRIDE_CALLERID] Query :SELECT callerid_name as cid_name,callerid_number as cid_number,accountid FROM accounts_callerid WHERE accountid = 110 AND status=0 LIMIT 1
752c2d8a-36f2-11ea-8ae6-dd6cf8c94168 2020-01-14 18:22:58.014930 [ERR] mod_json_cdr.c:396 Got error [0] posting to web server [http://localhost:8735/cdr.php]
752c2d8a-36f2-11ea-8ae6-dd6cf8c94168 2020-01-14 18:22:58.014930 [ERR] mod_json_cdr.c:415 Unable to post to web server
752c2d8a-36f2-11ea-8ae6-dd6cf8c94168 2020-01-14 18:22:58.014930 [ERR] mod_json_cdr.c:232 Can't open /usr/share/freeswitch/log/xml_json/752c2d8a-36f2-11ea-8ae6-dd6cf8c94168.cdr.json! [Too many open files]
7db77040-36f2-11ea-95de-dd6cf8c94168 2020-01-14 18:22:58.014930 [ERR] switch_core_media.c:7567 AUDIO RTP REPORTS ERROR: [Socket Error!]
2020-01-14 18:22:58.014930 [ERR] switch_core_sqldb.c:587 NATIVE SQL ERR [unable to open database file]
2020-01-14 18:22:58.014930 [ERR] switch_core_sqldb.c:587 NATIVE SQL ERR [unable to open database file]
7ffd0fc2-36f2-11ea-997c-dd6cf8c94168 2020-01-14 18:22:58.034923 [ERR] mod_json_cdr.c:396 Got error [0] posting to web server [http://localhost:8735/cdr.php]
7ffd0fc2-36f2-11ea-997c-dd6cf8c94168 2020-01-14 18:22:58.034923 [ERR] mod_json_cdr.c:415 Unable to post to web server
7ffd0fc2-36f2-11ea-997c-dd6cf8c94168 2020-01-14 18:22:58.034923 [ERR] mod_json_cdr.c:232 Can't open /usr/share/freeswitch/log/xml_json/7ffd0fc2-36f2-11ea-997c-dd6cf8c94168.cdr.json! [Too many open files]
7db77040-36f2-11ea-95de-dd6cf8c94168 2020-01-14 18:22:58.034923 [ERR] mod_json_cdr.c:396 Got error [0] posting to web server [http://localhost:8735/cdr.php]
7db77040-36f2-11ea-95de-dd6cf8c94168 2020-01-14 18:22:58.034923 [ERR] mod_json_cdr.c:415 Unable to post to web server
7db77040-36f2-11ea-95de-dd6cf8c94168 2020-01-14 18:22:58.034923 [ERR] mod_json_cdr.c:232 Can't open /usr/share/freeswitch/log/xml_json/7db77040-36f2-11ea-95de-dd6cf8c94168.cdr.json! [No such file or directory]

obviously the ulimit parameters was setted up in this way:

ulimit -c unlimited # The maximum size of core files created.
ulimit -d unlimited # The maximum size of a process's data segment.
ulimit -f unlimited # The maximum size of files created by the shell (default option)
ulimit -i unlimited # The maximum number of pending signals
ulimit -n 999999 # The maximum number of open file descriptors.
ulimit -q unlimited # The maximum POSIX message queue size
ulimit -u unlimited # The maximum number of processes available to a single user.
ulimit -v unlimited # The maximum amount of virtual memory available to the process.
ulimit -x unlimited # ???
ulimit -s 240 # The maximum stack size
ulimit -l unlimited # The maximum size that may be locked into memory.
ulimit -a # All current limits are reported.

The hardware/software configuration is as showed below:

Linux CentOS-77-64-minimal 3.10.0-1062.4.3.el7.x86_64 #1 SMP Wed Nov 13 23:58:53 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz 16 Core

MemTotal: 65713944 kB
MemFree: 51454192 kB
MemAvailable: 61044308 kB
Buffers: 1102580 kB
Cached: 10855628 kB
SwapCached: 0 kB

2 x 960 GB NVMe Datacenter Edition (software-RAID 1)

any suggestion?