Re: BUG #17116: Assert failed in SerialSetActiveSerXmin() on commit of parallelized serializable transaction

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #17116: Assert failed in SerialSetActiveSerXmin() on commit of parallelized serializable transaction
Date: 2021-07-26 20:00:00
Message-ID: 66a6851c-e213-b31a-c8e6-789ab06e17f1@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello Thomas,

26.07.2021 10:36, Thomas Munro wrote:
> On Sat, Jul 24, 2021 at 12:56 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
>> On Thu, Jul 22, 2021 at 11:23 PM PG Bug reporting form
>> <noreply(at)postgresql(dot)org> wrote: '.
>>> #2 0x0000555e1740b1ac in ExceptionalCondition (
>>> conditionName=conditionName(at)entry=0x555e17581ce8
>>> "!TransactionIdIsValid(serialControl->tailXid) || TransactionIdFollows(xid,
>>> serialControl->tailXid)", errorType=errorType(at)entry=0x555e17466028
>>> "FailedAssertion",
>>> fileName=fileName(at)entry=0x555e17581789 "predicate.c",
>>> lineNumber=lineNumber(at)entry=1056) at assert.c:67
>> Thanks. Repro'd here. Not immediately sure what's happening here,
>> but I will look into it next week.
> Here's a draft patch that includes your test spec. Without the
> included change to predicate.c, it hits the assertion. With it, it
> doesn't, and pg_locks shows no leaked locks after the isolation checks
> run (that was the problem 47a338cf fixed before 12 was released, but
> it fixed it a little too far in the opposite direction, fortunately
> without ill effect AFAICS besides wasted CPU cycles).

Thanks! I'm not sure, whether this is related to the fix, but my
parallel installcheck script (attached) catches another assert with the
patch applied:

Core was generated by `postgres: postgres regress33 127.0.0.1(48582) COM'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig(at)entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig(at)entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ff5251c7535 in __GI_abort () at abort.c:79
#2  0x000055b16d72aa32 in ExceptionalCondition (
    conditionName=conditionName(at)entry=0x55b16d89ccd0
"!SxactIsPartiallyReleased(MySerializableXact)",
    errorType=errorType(at)entry=0x55b16d78301d "FailedAssertion",
fileName=fileName(at)entry=0x55b16d89bbc9 "predicate.c",
    lineNumber=lineNumber(at)entry=4859) at assert.c:67
#3  0x000055b16d5f8a3a in PreCommit_CheckForSerializationFailure () at
predicate.c:4859
#4  0x000055b16d34227d in CommitTransaction () at xact.c:2140
#5  0x000055b16d3435b5 in CommitTransactionCommand () at xact.c:3085
#6  0x000055b16d602369 in finish_xact_command () at postgres.c:2662
#7  0x000055b16d604a23 in finish_xact_command () at postgres.c:2660
#8  exec_simple_query (query_string=0x55b16e9c6980 "COMMIT;") at
postgres.c:1264
#9  0x000055b16d6060d9 in PostgresMain (argc=<optimized out>,
argv=argv(at)entry=0x55b16e9f66a8, dbname=<optimized out>,
    username=<optimized out>) at postgres.c:4339
#10 0x000055b16d57936f in BackendRun (port=0x55b16e9f40b0,
port=0x55b16e9f40b0) at postmaster.c:4526
#11 BackendStartup (port=0x55b16e9f40b0) at postmaster.c:4210
#12 ServerLoop () at postmaster.c:1739
#13 0x000055b16d57a36c in PostmasterMain (argc=3, argv=0x55b16e9c1320)
at postmaster.c:1412
#14 0x000055b16d28bf5b in main (argc=3, argv=0x55b16e9c1320) at main.c:210

---
/tmp/t/ic01-33/src/test/isolation/expected/serializable-parallel-2.out
2021-07-26 22:04:06.206541268 +0300
+++
/tmp/t/ic01-33/src/test/isolation/output_iso/results/serializable-parallel-2.out      
2021-07-26 22:08:04.883339810 +0300
@@ -47,4 +47,6 @@
 10
 (10 rows)

-step s2c: COMMIT;
+lock wait query failed: server closed the connection unexpectedly
+       This probably means the server terminated abnormally
+       before or while processing the request.

If time permits, I will compose (till the weekend) yet another isolation
test to demonstrate this fail. But maybe the script can be useful as is.
(To simplify things I left only serializable-parallel* tests in
isolation_schedule.)

Best regards,
Alexander

Attachment Content-Type Size
icx.tar.bz2 application/x-bzip 6.5 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Japin Li 2021-07-27 02:28:17 Re: Statistics updates is delayed when using `commit and chain`
Previous Message Lætitia Avrot 2021-07-26 15:53:34 Re: Statistics updates is delayed when using `commit and chain`