Closed sushantrmishra closed 10 months ago
How to dump the memory usage of webserver:
Connect to process using gdb and follow these commands: Below is just an example, not from node where problem happened.
(gdb) call (void*)(malloc(sizeof(8192)))
$1 = (void *) 0x6a37fd05040
(gdb) call YBCGetHeapConsumption(0x6a37fd05040)
$2 = (struct YBCStatusStruct *) 0x0
(gdb) p (YbTcmallocStats*)(0x6a37fd05040)
$3 = (struct YbTcmallocStats *) 0x6a37fd05040
(gdb) p *(YbTcmallocStats*)(0x6a37fd05040)
$4 = {total_physical_bytes = 18106982, heap_size_bytes = 4194304, current_allocated_bytes = 1067904,
pageheap_free_bytes = 2187264, pageheap_unmapped_bytes = 0}
(gdb) p PgMemTracker.pg_cur_mem_bytes
$5 = 255552
Webserver endpoint is accessed by following endpoints"
@sushantrmishra Looks like we are caching last result, which is looks like memory leak:
This is SQLancer test (lots of random queries)
Start test
[yugabyte@ip-172-151-19-221 ~]$ ps -eo pid,pcpu,pmem,vsz,rss,command | grep YSQL
45448 0.0 0.4 2404900 31760 postgres: YSQL webserver
[yugabyte@ip-172-151-19-221 ~]$ ps -eo pid,pcpu,pmem,vsz,rss,command | grep YSQL
45448 0.0 0.7 2404900 56712 postgres: YSQL webserver
[yugabyte@ip-172-151-19-221 ~]$ ps -eo pid,pcpu,pmem,vsz,rss,command | grep YSQL
45448 0.0 0.7 2404900 56808 postgres: YSQL webserver
Memory grew few times and not cleared.
SQLancer reproducer (since there are a lot of unique queries)
https://github.com/yugabyte/sqlancer/releases/tag/sqlancer_2.0.0-yb
java -Xmx12G -jar /PATH/TO/sqlancer-2.0.0-yb.jar --host 127.0.0.1 --port 5433 --username yugabyte --password yugabyte --num-threads 24 --timeout-seconds 28800 ysql --oracle HAVING
/statements
endpoint. After that memory usage of the process should increase./statements-reset
endpoint.This issue is fixed as part of the fix for the following issues.
Jira Link: DB-8133
Description
OOM logs: PID = 14355 is consuming 39791*4k ~160MB memory. @cdavid looked at this and mentioned this was the YSQL webserver process . It is not clear why the memory usage is high in
webserver
. I tried loadingpg_stat_statments
using the tserver/statements page but that did not change the memory usage.Warning: Please confirm that this issue does not contain any sensitive information