pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix incorrect order of lock file removal and failure to close() 7+ messages / 1 participants [nested] [flat]
* pgsql: Fix incorrect order of lock file removal and failure to close() @ 2015-08-02 18:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-08-02 18:55 UTC (permalink / raw) To: pgsql-committers Fix incorrect order of lock file removal and failure to close() sockets. Commit c9b0cbe98bd783e24a8c4d8d8ac472a494b81292 accidentally broke the order of operations during postmaster shutdown: it resulted in removing the per-socket lockfiles after, not before, postmaster.pid. This creates a race-condition hazard for a new postmaster that's started immediately after observing that postmaster.pid has disappeared; if it sees the socket lockfile still present, it will quite properly refuse to start. This error appears to be the explanation for at least some of the intermittent buildfarm failures we've seen in the pg_upgrade test. Another problem, which has been there all along, is that the postmaster has never bothered to close() its listen sockets, but has just allowed them to close at process death. This creates a different race condition for an incoming postmaster: it might be unable to bind to the desired listen address because the old postmaster is still incumbent. This might explain some odd failures we've seen in the past, too. (Note: this is not related to the fact that individual backends don't close their client communication sockets. That behavior is intentional and is not changed by this patch.) Fix by adding an on_proc_exit function that closes the postmaster's ports explicitly, and (in 9.3 and up) reshuffling the responsibility for where to unlink the Unix socket files. Lock file unlinking can stay where it is, but teach it to unlink the lock files in reverse order of creation. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/d73d14c271653dff10c349738df79ea03b85236c Modified Files -------------- src/backend/libpq/pqcomm.c | 54 ++++++++++++++++------------------- src/backend/postmaster/postmaster.c | 47 ++++++++++++++++++++++++++++++ src/backend/utils/init/miscinit.c | 6 +++- src/include/libpq/libpq.h | 1 + 4 files changed, 78 insertions(+), 30 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix incorrect order of lock file removal and failure to close() @ 2015-08-02 18:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-08-02 18:55 UTC (permalink / raw) To: pgsql-committers Fix incorrect order of lock file removal and failure to close() sockets. Commit c9b0cbe98bd783e24a8c4d8d8ac472a494b81292 accidentally broke the order of operations during postmaster shutdown: it resulted in removing the per-socket lockfiles after, not before, postmaster.pid. This creates a race-condition hazard for a new postmaster that's started immediately after observing that postmaster.pid has disappeared; if it sees the socket lockfile still present, it will quite properly refuse to start. This error appears to be the explanation for at least some of the intermittent buildfarm failures we've seen in the pg_upgrade test. Another problem, which has been there all along, is that the postmaster has never bothered to close() its listen sockets, but has just allowed them to close at process death. This creates a different race condition for an incoming postmaster: it might be unable to bind to the desired listen address because the old postmaster is still incumbent. This might explain some odd failures we've seen in the past, too. (Note: this is not related to the fact that individual backends don't close their client communication sockets. That behavior is intentional and is not changed by this patch.) Fix by adding an on_proc_exit function that closes the postmaster's ports explicitly, and (in 9.3 and up) reshuffling the responsibility for where to unlink the Unix socket files. Lock file unlinking can stay where it is, but teach it to unlink the lock files in reverse order of creation. Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/72697d2ba77074713cd4008995a97cf284de1712 Modified Files -------------- src/backend/libpq/pqcomm.c | 54 ++++++++++++++++------------------- src/backend/postmaster/postmaster.c | 47 ++++++++++++++++++++++++++++++ src/backend/utils/init/miscinit.c | 6 +++- src/include/libpq/libpq.h | 1 + 4 files changed, 78 insertions(+), 30 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix incorrect order of lock file removal and failure to close() @ 2015-08-02 18:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-08-02 18:55 UTC (permalink / raw) To: pgsql-committers Fix incorrect order of lock file removal and failure to close() sockets. Commit c9b0cbe98bd783e24a8c4d8d8ac472a494b81292 accidentally broke the order of operations during postmaster shutdown: it resulted in removing the per-socket lockfiles after, not before, postmaster.pid. This creates a race-condition hazard for a new postmaster that's started immediately after observing that postmaster.pid has disappeared; if it sees the socket lockfile still present, it will quite properly refuse to start. This error appears to be the explanation for at least some of the intermittent buildfarm failures we've seen in the pg_upgrade test. Another problem, which has been there all along, is that the postmaster has never bothered to close() its listen sockets, but has just allowed them to close at process death. This creates a different race condition for an incoming postmaster: it might be unable to bind to the desired listen address because the old postmaster is still incumbent. This might explain some odd failures we've seen in the past, too. (Note: this is not related to the fact that individual backends don't close their client communication sockets. That behavior is intentional and is not changed by this patch.) Fix by adding an on_proc_exit function that closes the postmaster's ports explicitly, and (in 9.3 and up) reshuffling the responsibility for where to unlink the Unix socket files. Lock file unlinking can stay where it is, but teach it to unlink the lock files in reverse order of creation. Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/c6d901292f3de94f82a3cfb0f0149eacda09f92b Modified Files -------------- src/backend/libpq/pqcomm.c | 51 +++++++++++++++-------------------- src/backend/postmaster/postmaster.c | 47 ++++++++++++++++++++++++++++++++ src/backend/utils/init/miscinit.c | 6 ++++- src/include/libpq/libpq.h | 1 + 4 files changed, 75 insertions(+), 30 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix incorrect order of lock file removal and failure to close() @ 2015-08-02 18:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-08-02 18:55 UTC (permalink / raw) To: pgsql-committers Fix incorrect order of lock file removal and failure to close() sockets. Commit c9b0cbe98bd783e24a8c4d8d8ac472a494b81292 accidentally broke the order of operations during postmaster shutdown: it resulted in removing the per-socket lockfiles after, not before, postmaster.pid. This creates a race-condition hazard for a new postmaster that's started immediately after observing that postmaster.pid has disappeared; if it sees the socket lockfile still present, it will quite properly refuse to start. This error appears to be the explanation for at least some of the intermittent buildfarm failures we've seen in the pg_upgrade test. Another problem, which has been there all along, is that the postmaster has never bothered to close() its listen sockets, but has just allowed them to close at process death. This creates a different race condition for an incoming postmaster: it might be unable to bind to the desired listen address because the old postmaster is still incumbent. This might explain some odd failures we've seen in the past, too. (Note: this is not related to the fact that individual backends don't close their client communication sockets. That behavior is intentional and is not changed by this patch.) Fix by adding an on_proc_exit function that closes the postmaster's ports explicitly, and (in 9.3 and up) reshuffling the responsibility for where to unlink the Unix socket files. Lock file unlinking can stay where it is, but teach it to unlink the lock files in reverse order of creation. Branch ------ REL9_3_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/fad824a88cfc5973eacc8df061879665bc86e3b3 Modified Files -------------- src/backend/libpq/pqcomm.c | 51 +++++++++++++++-------------------- src/backend/postmaster/postmaster.c | 47 ++++++++++++++++++++++++++++++++ src/backend/utils/init/miscinit.c | 6 ++++- src/include/libpq/libpq.h | 1 + 4 files changed, 75 insertions(+), 30 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix incorrect order of lock file removal and failure to close() @ 2015-08-02 18:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-08-02 18:55 UTC (permalink / raw) To: pgsql-committers Fix incorrect order of lock file removal and failure to close() sockets. Commit c9b0cbe98bd783e24a8c4d8d8ac472a494b81292 accidentally broke the order of operations during postmaster shutdown: it resulted in removing the per-socket lockfiles after, not before, postmaster.pid. This creates a race-condition hazard for a new postmaster that's started immediately after observing that postmaster.pid has disappeared; if it sees the socket lockfile still present, it will quite properly refuse to start. This error appears to be the explanation for at least some of the intermittent buildfarm failures we've seen in the pg_upgrade test. Another problem, which has been there all along, is that the postmaster has never bothered to close() its listen sockets, but has just allowed them to close at process death. This creates a different race condition for an incoming postmaster: it might be unable to bind to the desired listen address because the old postmaster is still incumbent. This might explain some odd failures we've seen in the past, too. (Note: this is not related to the fact that individual backends don't close their client communication sockets. That behavior is intentional and is not changed by this patch.) Fix by adding an on_proc_exit function that closes the postmaster's ports explicitly, and (in 9.3 and up) reshuffling the responsibility for where to unlink the Unix socket files. Lock file unlinking can stay where it is, but teach it to unlink the lock files in reverse order of creation. Branch ------ REL9_2_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/20d1878b6a7f78a4a9ce3668c4588d92bc0af78d Modified Files -------------- src/backend/postmaster/postmaster.c | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix incorrect order of lock file removal and failure to close() @ 2015-08-02 18:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-08-02 18:55 UTC (permalink / raw) To: pgsql-committers Fix incorrect order of lock file removal and failure to close() sockets. Commit c9b0cbe98bd783e24a8c4d8d8ac472a494b81292 accidentally broke the order of operations during postmaster shutdown: it resulted in removing the per-socket lockfiles after, not before, postmaster.pid. This creates a race-condition hazard for a new postmaster that's started immediately after observing that postmaster.pid has disappeared; if it sees the socket lockfile still present, it will quite properly refuse to start. This error appears to be the explanation for at least some of the intermittent buildfarm failures we've seen in the pg_upgrade test. Another problem, which has been there all along, is that the postmaster has never bothered to close() its listen sockets, but has just allowed them to close at process death. This creates a different race condition for an incoming postmaster: it might be unable to bind to the desired listen address because the old postmaster is still incumbent. This might explain some odd failures we've seen in the past, too. (Note: this is not related to the fact that individual backends don't close their client communication sockets. That behavior is intentional and is not changed by this patch.) Fix by adding an on_proc_exit function that closes the postmaster's ports explicitly, and (in 9.3 and up) reshuffling the responsibility for where to unlink the Unix socket files. Lock file unlinking can stay where it is, but teach it to unlink the lock files in reverse order of creation. Branch ------ REL9_1_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/f1e84d3ebd6062f5bb25cdc7017be1ffa3364f49 Modified Files -------------- src/backend/postmaster/postmaster.c | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix incorrect order of lock file removal and failure to close() @ 2015-08-02 18:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-08-02 18:55 UTC (permalink / raw) To: pgsql-committers Fix incorrect order of lock file removal and failure to close() sockets. Commit c9b0cbe98bd783e24a8c4d8d8ac472a494b81292 accidentally broke the order of operations during postmaster shutdown: it resulted in removing the per-socket lockfiles after, not before, postmaster.pid. This creates a race-condition hazard for a new postmaster that's started immediately after observing that postmaster.pid has disappeared; if it sees the socket lockfile still present, it will quite properly refuse to start. This error appears to be the explanation for at least some of the intermittent buildfarm failures we've seen in the pg_upgrade test. Another problem, which has been there all along, is that the postmaster has never bothered to close() its listen sockets, but has just allowed them to close at process death. This creates a different race condition for an incoming postmaster: it might be unable to bind to the desired listen address because the old postmaster is still incumbent. This might explain some odd failures we've seen in the past, too. (Note: this is not related to the fact that individual backends don't close their client communication sockets. That behavior is intentional and is not changed by this patch.) Fix by adding an on_proc_exit function that closes the postmaster's ports explicitly, and (in 9.3 and up) reshuffling the responsibility for where to unlink the Unix socket files. Lock file unlinking can stay where it is, but teach it to unlink the lock files in reverse order of creation. Branch ------ REL9_0_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/8b53c087d2685e187b8a8e2ea8b924d597396f2b Modified Files -------------- src/backend/postmaster/postmaster.c | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2015-08-02 18:55 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2015-08-02 18:55 pgsql: Fix incorrect order of lock file removal and failure to close() Tom Lane <tgl@sss.pgh.pa.us> 2015-08-02 18:55 pgsql: Fix incorrect order of lock file removal and failure to close() Tom Lane <tgl@sss.pgh.pa.us> 2015-08-02 18:55 pgsql: Fix incorrect order of lock file removal and failure to close() Tom Lane <tgl@sss.pgh.pa.us> 2015-08-02 18:55 pgsql: Fix incorrect order of lock file removal and failure to close() Tom Lane <tgl@sss.pgh.pa.us> 2015-08-02 18:55 pgsql: Fix incorrect order of lock file removal and failure to close() Tom Lane <tgl@sss.pgh.pa.us> 2015-08-02 18:55 pgsql: Fix incorrect order of lock file removal and failure to close() Tom Lane <tgl@sss.pgh.pa.us> 2015-08-02 18:55 pgsql: Fix incorrect order of lock file removal and failure to close() Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox