hanh
By:
hanh

Am I misunderstanding this crazy high SHMMAX value for postgres? Any thing else I should look at for a postgres server fatal errror?

September 2, 2017 92 views
PostgreSQL Ubuntu 16.04

I have a postgres server running as a backend for a low-usage flask site on a digital ocean droplet. The only thing that's going in is small amounts of text.

Suddenly this happened:

2017-08-16 04:49:26 UTC [13529-1] FATAL: could not map anonymous shared memory: Cannot allocate memory
2017-08-16 04:49:26 UTC [13529-2] HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 148488192 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing sharedbuffers or maxconnections.

According to cat /proc/sys/kernel/shmmax:

SHMMAX is: 18446744073692774399 or 18e18 bytes! (Postgres documentation does say it's bytes, not bits)
How did the error message get 148488192 bytes? I guess some kind of overflow. But this value is crazy!

My droplet only has 512Mb of memory.

Am I missing something?

Clearly this isn't the only thing that went wrong -- why would a low usage site with which only puts ~2kb of text in a table at a time suddenly be using too much memory?

FYI: This is my first time using a database or running a website.

I'm doing it as a low-stakes learning exercise, so any pointers into other logs I should look at, changing/what is happening with SHMMAX, or what else to look out for would be greatly appreciated.
It was running smoothly for a couple of months before this, and after rebooting the droplet, everything has continued to run smoothly.

The full Postgres logs were:

2017-08-16 04:49:17 UTC [1583-2] LOG: received fast shutdown request
2017-08-16 04:49:17 UTC [1583-3] LOG: aborting any active transactions
2017-08-16 04:49:17 UTC [1588-2] LOG: autovacuum launcher shutting down
2017-08-16 04:49:17 UTC [5146-1] user@user FATAL: terminating connection due to administrator command
2017-08-16 04:49:17 UTC [5149-1] user@user FATAL: terminating connection due to administrator command
2017-08-16 04:49:17 UTC [5147-1] user@user FATAL: terminating connection due to administrator command
2017-08-16 04:49:17 UTC [1585-1] LOG: shutting down
2017-08-16 04:49:17 UTC [1585-2] LOG: database system is shut down
2017-08-16 04:49:26 UTC [13529-1] FATAL: could not map anonymous shared memory: Cannot allocate memory
2017-08-16 04:49:26 UTC [13529-2] HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 148488192 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing sharedbuffers or maxconnections.

Be the first one to answer this question.