Description

This article explains what steps can be followed to troubleshoot high memory utilization by jsqlsyncd process in SRX devices.

Symptoms

  • JSQLSYNCD process memory usage is really high. In the below example memory size is ~4G ( 4021M)

UserA@FW-SITE1> show system processes extensive | match jsqlsync

PID USERNAME PRI NICE  SIZE  RES STATE  C  TIME  WCPU COMMAND

21672 root     28  0 4021M 1169M select  1 11:20  0.00% jsqlsyncd{jsqlsyncd}

21672 root     20  0 4021M 1169M sbwait  0  0:01  0.00% jsqlsyncd{jsqlsyncd}

21672 root     20  0 4021M 1169M sigwai  1  0:01  0.00% jsqlsyncd{jsqlsyncd}

 

  • Following error messages observed in /var/log/messages

Jul 16 18:45:52 FW-SITE1 jsqlsyncd[21672]: failed to dump logs

Jul 16 18:45:52 FW-SITE1 jsqlsyncd[21672]: SQL error: out of memory

 

  • Following error messages observed in debug log file /var/log/jsqlsyncd_log.txt

 

Jul 16 23:40:11 jsqlsyncd[21672]:ERROR:js_ReadRepl:2365 failed to dump logs

Jul 16 23:40:11 jsqlsyncd[21672]:ERROR:js_ReadRepl:2366 SQL error: out of memory

Jul 16 23:40:11 jsqlsyncd[21672]:DBUG:js_check_db:3135 /var/db/secintel_db/sql/manifest.db: sync_id=0 state set HOT

Jul 16 23:40:11 jsqlsyncd[21672]:DBUG:js_BackupOk:2704 time=15s up=1 filterup=1

Jul 16 23:40:11 jsqlsyncd[21672]:DBUG:js_BackupOk:2704 time=15s up=1 filterup=1

Jul 16 23:40:11 jsqlsyncd[21672]:DBUG:js_check_db:3062 /var/db/secintel_db/sql/CC.db: sync_id=0 wait=0 status=0 (HOT)

Jul 16 23:40:11 jsqlsyncd[21672]:ERROR:js_ReadRepl:2333 can't open db /var/db/secintel_db/sql/CC.db rc=7

 

  • Secintel replication db file size is higher than regular db files. In the below example manifest.db.repl.sdb and CC.db.repl.sdb size is higher than respective db files i,e manifest.db and CC.db.

 

root@FW-SITE1 :/var/db/secintel_db/sql # ls -ltr

total 2143656

-rw-r--r-- 1 root wheel    24576 Apr 19 05:25 Infected-Hosts.db

-rw-r--r-- 1 root wheel    40960 Apr 19 05:25 Whitelist.db

-rw-r--r-- 1 root wheel    24576 Apr 19 05:30 Infected-Hosts.db.repl.sdb

-rw-r--r-- 1 root wheel    24576 Jul 15 08:35 Whitelist.db.repl.sdb

-rw-r--r-- 1 root wheel   9592832 Jul 16 21:26 CC.db

-rw-r--r-- 1 root wheel 2180726784 Jul 16 22:59 CC.db.repl.sdb

-rw-r--r-- 1 root wheel    24576 Jul 16 22:59 manifest.db

-rw-r--r-- 1 root wheel   3944448 Jul 16 23:28 manifest.db.repl.sdb

 

Solution

jsqlsyncd porcess is used in cluster deployment where it will sync the secintel db files form the primary to secondary node. /var/db/secintel_db folder will have .db and .repl.sdb files. Jsqlsyncd will compare the repl.sdb ( which contains headers of the records) and if there is any need to update then it will sync the db file to the secondary node and reset the repl.sdb. When Jsqlsyncd memory usage is high then replication of sencintel db files from primary to secondary will not be take place and replication db files ( repl.sdb) size may start to grow under /var/db/secintel_db/sql. 

DATA COLLECTION: 
Following log collection guidelines will help to investigate the problem further. 
  • Check the process usage periodically ( around 6 hr interval) using below command and collect the outputs. 

              'show system processes extensive | match "Laundry|jsqlsyncd"'
  • Login to shell as root and verify the db files and repl.sdb files sizes under /var/db/secintel_db/sql path. Collect the output of "ls -ltr  /var/db/secintel_db/sql/* "
  •  If the jsqlsyncd process usage is consistenly above 980MB and repl.sdb files also start to grow then enable the jsqlsyncd debug traces and collect it for 3min.
    •   Enable Debug traces: Login to shell as root user and execute below command      
                  echo 7 > /var/tmp/JSDBDebug
                   < Wait for ~3 minute>
  •  Disable Debug traces: Login to shell as root user and execute below command 
         echo 0 > /var/tmp/JSDBDebug
  •   Collect all the logs under /var/log/jsqlsyncd_log.txt*
 
  • Collect all secintel db files  from below mentioned paths.  

             /var/db/secintel_db/sql 

              /var/db/ipid

Recovery : 

Following steps can help to recover the memory usage of jsqlsyncd. 
  • Login to shell as root and the get the pid of jsqlsyncd process. 
root@user1:/var/db/secintel_db/sql # ps -aux | grep jsql
root   15623   0.0  0.3 738448  11680  -  S    21:48   0:00.03 /usr/sbin/jsqlsyncd -N
root   17346   0.0  0.1  12744   2540  0  S+   21:51   0:00.00 grep jsql
  • Generate coredump of the process which will also restart the process using below command 
kill -6 <jsqlsyncd-pid>
In the above example the command would be " kill -6  15623". After the core is generated a new processes comes up in ~15 seconds. Attach the generated core file and logs collected as part of data collection to the JTAC case. 


Note: No need to failover the cluster for  redundancy group RG0 before restart of jsqlsyncd.

Alternatively an automatic shell script can be used to collect logs and auto restart the jsqlsyncd process based on the memory usage . Refer to KB87635 [juniper.net]
 

Modification History

2024-09-19 : Article Created