cyberdem0n / bg_mon Goto Github PK
View Code? Open in Web Editor NEWBackground worker for monitoring PostgreSQL
License: MIT License
Background worker for monitoring PostgreSQL
License: MIT License
The pgxn.org repository provides an installation utility called pgxnclient for installing PostgreSQL extensions. This is much simpler than the make;make install for several platforms.
We are looking at an issue that some of our postgres instances running with the Zalando Operator (Version 1.10.1, PVCs on NFS, Spilo Image spilo-15:3.0-p1
), sometimes get stuck during restart. The instances cannot be killed with pg_ctl -m immediate stop
and when using pg_ctl kill KILL
, usually a single process stuck in uninterruptible sleep remains:
1000710+ 1191929 0.0 0.0 630156 26628 ? Ds Jan18 2:05 postgres: our-postgres: bg_mon
Unfortunately I missed capturing the stack of that process before finally rebooting the machine (will certainly do it next time), but I would like to start a discussion here if there are any known issues around this or if you have any suspicions what could cause this.
Hello, @CyberDem0n
I would like to extend bg_mon
to report the sizes of pg_replslot
and pgsql_tmp
. My question is how to do it in the best way.
I can follow the implementation of pg_log
directory size . That however will duplicate data bg_mon
reports under the device
key for the most common case where all subdirectories reside at the same place (such duplication already happens for data
, wal
, and log
entries). This approach also does not look extensible if one needs to add sizes of more subdirectories of $PGDATA
to the bg_mon
in the future.
Or I can create a separate subdirectories
dictionary with "subdirectory": its size in KB
key-value pairs. The dictionary will list all subdirectories in $PGDATA
wdyt ?
Example:
"query": "standby 10.2.76.25(45778) sending backup "pg_basebackup base backup""
We have found that PostgreSQL has killed itself after a segmentation fault issued against the bg_mon
extension:
2018-11-09 07:54:18 UTC [22072]: [9499-1] user=,db= LOG: worker process: bg_mon (PID 20867) was terminated by signal 11: Segmentation fault
2018-11-09 07:54:18 UTC [22072]: [9500-1] user=,db= DETAIL: Failed process was running: WITH locked_processes AS (SELECT this.pid [ ... ]
2018-11-09 07:54:18 UTC [22072]: [9501-1] user=,db= LOG: terminating any other active server processes
2018-11-09 07:54:18 UTC [20875]: [1-1] user=postgres,db=[unknown] WARNING: terminating connection because of crash of another server process
2018-11-09 07:54:18 UTC [20875]: [2-1] user=postgres,db=[unknown] DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
2018-11-09 07:54:18 UTC [20875]: [3-1] user=postgres,db=[unknown] HINT: In a moment you should be able to reconnect to the database and repeat your command.
2018-11-09 07:54:19 UTC [3580]: [1-1] user=postgres,db=postgres FATAL: the database system is in recovery mode
Since we've disabled it, we never run into that issue again.
We are using PostgreSQL v10.5 on Ubuntu 16.04 LTS.
Not sure why this happened or if this information is helpful. Let me know if I can provide other information.
error during bg_mon build for PostgreSQL 15 (beta 3)
Cloning into 'bg_mon'...
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -DUIFILE='"/usr/share/postgresql/15/contrib/bg_mon.html"' -DHAS_LIBBROTLI -I. -I./ -I/usr/include/postgresql/15/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -c -o bg_mon.o bg_mon.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -DUIFILE='"/usr/share/postgresql/15/contrib/bg_mon.html"' -DHAS_LIBBROTLI -I. -I./ -I/usr/include/postgresql/15/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -c -o brotli_utils.o brotli_utils.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -DUIFILE='"/usr/share/postgresql/15/contrib/bg_mon.html"' -DHAS_LIBBROTLI -I. -I./ -I/usr/include/postgresql/15/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -c -o disk_stats.o disk_stats.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -DUIFILE='"/usr/share/postgresql/15/contrib/bg_mon.html"' -DHAS_LIBBROTLI -I. -I./ -I/usr/include/postgresql/15/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -c -o net_stats.o net_stats.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -DUIFILE='"/usr/share/postgresql/15/contrib/bg_mon.html"' -DHAS_LIBBROTLI -I. -I./ -I/usr/include/postgresql/15/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -c -o postgres_stats.o postgres_stats.c
postgres_stats.c: In function ‘get_pg_stat_activity’:
postgres_stats.c:1131:3: error: too few arguments to function ‘InitPostgres’
1131 | InitPostgres("postgres", InvalidOid, NULL, InvalidOid, NULL, false);
| ^~~~~~~~~~~~
In file included from postgres_stats.c:6:
/usr/include/postgresql/15/server/miscadmin.h:460:13: note: declared here
460 | extern void InitPostgres(const char *in_dbname, Oid dboid,
| ^~~~~~~~~~~~
make: *** [<builtin>: postgres_stats.o] Error 1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.