Re: Missed condition-variable wakeups on FreeBSD

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Missed condition-variable wakeups on FreeBSD
Date: 2022-02-28 00:00:26
Message-ID: CA+hUKGJdbn0e_eJsfm1-PucUgpFrrKWczDvvw8PjV6UQjOURyg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Feb 27, 2022 at 8:07 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I don't know much about how gdb interacts with kernel calls on
> FreeBSD, but I speculate that the poll(2) call returns with EINTR
> after gdb releases the process, and then things resume fine,

Yeah, at least FreeBSD and macOS interrupt system calls when you send
SIGSTOP + SIGCONT directly, or when gdb and lldb do something similar
via ptrace. The same applies on Linux, except that Linux restarts the
system call automatically (even though the man page has this in the
list of system calls that never restart) so you don't usually notice
(though you can see it with strace). It's not really clear to me what
should happen given the language around restarts is all about signal
handlers, and stop + cont are system magic, not signal handlers.
Anyway...

> suggesting that we lost an interrupt somewhere.

So it's happening on an i386 kernel, with WAIT_USE_POLL (not
WAIT_USE_KQUEUE), but only under the build farm script (not when you
ran it manually in loop).... hmmm.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2022-02-28 00:19:21 Re: Checkpointer sync queue fills up / loops around pg_usleep() are bad
Previous Message Jeff Davis 2022-02-27 23:17:44 Re: Proposal: Support custom authentication methods using hooks