Re: pg_basebackup caused FailedAssertion
Heikki Linnakangas <hlinnakangas@vmware.com>
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Tom Lane <tgl@sss.pgh.pa.us>, Fujii Masao <masao.fujii@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2013-02-27T17:29:31Z
Lists: pgsql-hackers
On 26.02.2013 19:42, Tom Lane wrote:
> Fujii Masao<masao.fujii@gmail.com> writes:
>> In HEAD, when I ran "pg_basebackup -D hoge -X stream",
>> I got the following FailedAssertion error:
>
>> TRAP: FailedAssertion("!((wakeEvents& ((1<< 1) | (1<< 2))) != (1<<
>> 2))", File: "pg_latch.c", Line: 234)
>
>> This error happens after the commit 0b6329130e8e4576e97ff763f0e773347e1a88af.
>
>> This assertion error happens when WL_SOCKET_WRITEABLE without
>> WL_SOCKET_READABLE is specified in WaitLatchOrSocket(). This
>> condition is met when walsender has received CopyDone from the client,
>> but the output buffer is not empty. If reaching such condition is legitimate,
>> I think that we should get rid of the Assertion check which caused the above
>> FailedAssertion error. Thought?
>
> The reason for the assertion is that that case doesn't actually work.
> The code that is passing that combination of flags needs to be changed.
> Or else you can try to implement the ability to support READABLE only.
Right. I fixed that by adding WL_SOCKET_READABLE, and handling any
messages that might arrive after the frontend already sent CopyEnd. The
frontend shouldn't send any messages after CopyEnd, until it receives a
CopyEnd from the backend.
In theory, the frontend could already send the next query before
receiving the CopyEnd, but libpq doesn't currently allow that. Until
someone writes a client that actually tries to do that, I'm not going to
try to support that in the backend. It would be a lot more work, and
likely be broken anyway, without any way to test it.
Thanks for the report!
- Heikki
Commits
-
Revert "Cannot use WL_SOCKET_WRITEABLE without WL_SOCKET_READABLE."
- 133a0906d5bf 9.5.25 landed
- f10da1e9c970 9.6.21 landed
- ac7df6e8feeb 10.16 landed
- 4ee058a3bd9b 11.11 landed
- fde5f130c9c3 13.2 landed
- 706d84fe701e 12.6 landed
- a58db3aa10e6 14.0 landed
-
Cannot use WL_SOCKET_WRITEABLE without WL_SOCKET_READABLE.
- 3a9e64aa0d96 9.3.0 cited
-
Make pg_receivexlog and pg_basebackup -X stream work across timeline switches.
- 0b6329130e8e 9.3.0 cited