Skip to content
This repository was archived by the owner on Apr 1, 2023. It is now read-only.

PG cannot shutdown cleanly from SIGTERM #242

@jfunston

Description

@jfunston

There is a conflict between PG's handling of signals and seastar's. Seastar registers a handler for SIGTERM that relies on being able to access the local reactor, but the non-seastar threads do not have reactors, and by default there is no guarantee which thread will be delivered a signal. So the non-seastar threads will segfault if they get SIGTERM. To reproduce have an active PG connection and run "killall postgres".

#0 0x0000556f3315b179 in std::__uniq_ptr_impl<seastar::reactor_backend, std::default_deleteseastar::reactor_backend >::_M_ptr (this=0x20) at /usr/include/c++/9/bits/unique_ptr.h:360
#1 std::unique_ptr<seastar::reactor_backend, std::default_deleteseastar::reactor_backend >::get (this=0x20)
at /usr/include/c++/9/bits/unique_ptr.h:361
#2 std::unique_ptr<seastar::reactor_backend, std::default_deleteseastar::reactor_backend >::operator-> (
this=0x20) at /usr/include/c++/9/bits/unique_ptr.h:355
#3 seastar::reactor::signals::<lambda(int, siginfo_t*, void*)>::operator() (__closure=0x0, p=0x7ffed73ce380,
info=0x7ffed73ce4b0, sig=15) at ../../src/core/reactor.cc:641
#4 seastar::reactor::signals::<lambda(int, siginfo_t*, void*)>::_FUN(int, siginfo_t *, void *) ()
at ../../src/core/reactor.cc:642
#5
#6 0x00007f5858a7612b in __GI___select (nfds=nfds@entry=0, readfds=readfds@entry=0x0,
writefds=writefds@entry=0x0, exceptfds=exceptfds@entry=0x0, timeout=timeout@entry=0x7ffed73cf0a0)
at ../sysdeps/unix/sysv/linux/select.c:41
#7 0x0000556f32f1cbbb in pg_usleep (microsec=microsec@entry=10000)
at /build/src/k2/postgres/src/port/pgsleep.c:56

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions