pgpool / pgpool2

This is the official mirror of git://git.postgresql.org/git/pgpool2.git. Note that this is just a *mirror* - we don't work with pull requests on github. Please subscribe to pgpool-hackers mailing list from our website and submit your patch to this mailing list.
https://www.pgpool.net
Other
305 stars 87 forks source link

pgpool not releasing shared memory segments #6

Open gianpaolodn opened 7 years ago

gianpaolodn commented 7 years ago

Hi,

we are using Freebsd 10.3, and after restarting pgpool different times we were not able anymore to create shared mem segments;

pid 51116: FATAL: could not create shared memory for request size: 6144 pid 51116: DETAIL: shared memory creation failed with error "No error: 0"

Investing the code we came up with a problem in the IpcMemoryDelete in utils/pool_shmem.c @line 107

The function checks the number of processes attached to the memory segment and it returns 2.. but this 2 processes are pgpool itself (and maybe watchdog?). So it's returning without releasing the segment.

This cause the creation of a lot of segments if you start and stop pgpool continuously (and in a testing fase it could be normal). Lot of segments bring to reach the shmem OS configuration limit and than suddenly stops (pgpool) working.

We solved this not returning, but deleting the segment even if there are attached processes. Is it safe or the right solution?

If you want to reproduce the error just run pgpool, check segments with ipcs -m (or -p i bsd) and see the segments growing, then stop pgpool and you should see created segments still there.