Re: WaitLatchOrSocket seems to not count to 4 right... - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: WaitLatchOrSocket seems to not count to 4 right...
Date
Msg-id 8cf14992-f3d2-4429-040f-ca30b2fe70a7@oss.nttdata.com
Whole thread Raw
In response to WaitLatchOrSocket seems to not count to 4 right...  (Greg Stark <stark@mit.edu>)
Responses Re: WaitLatchOrSocket seems to not count to 4 right...  (Thomas Munro <thomas.munro@gmail.com>)
List pgsql-hackers

On 2022/02/08 7:00, Greg Stark wrote:
> Unless I'm misreading this code I think the nevents in
> WaitLatchOrSocket should really be 4 not 3. At least there are 4 calls
> to AddWaitEventToSet in it and I think it's possible to trigger all 4.

Good catch! I think you're right.

As the quick test, I confirmed that the assertion failure happened when I passed four possible events to
WaitLatchOrSocket()in postgres_fdw.
 

TRAP: FailedAssertion("set->nevents < set->nevents_space", File: "latch.c", Line: 868, PID: 54424)
0   postgres                            0x0000000107efa49f ExceptionalCondition + 223
1   postgres                            0x0000000107cbca0c AddWaitEventToSet + 76
2   postgres                            0x0000000107cbd86e WaitLatchOrSocket + 430
3   postgres_fdw.so                     0x000000010848b1aa pgfdw_get_result + 218
4   postgres_fdw.so                     0x000000010848accb do_sql_command + 75
5   postgres_fdw.so                     0x000000010848c6b8 configure_remote_session + 40
6   postgres_fdw.so                     0x000000010848c32d connect_pg_server + 1629
7   postgres_fdw.so                     0x000000010848aa06 make_new_connection + 566
8   postgres_fdw.so                     0x0000000108489a06 GetConnection + 550
9   postgres_fdw.so                     0x0000000108497ba4 postgresBeginForeignScan + 260
10  postgres                            0x0000000107a7d79f ExecInitForeignScan + 943
11  postgres                            0x0000000107a5c8ab ExecInitNode + 683
12  postgres                            0x0000000107a5028a InitPlan + 1386
13  postgres                            0x0000000107a4fb66 standard_ExecutorStart + 806
14  postgres                            0x0000000107a4f833 ExecutorStart + 83
15  postgres                            0x0000000107d0277f PortalStart + 735
16  postgres                            0x0000000107cfe150 exec_simple_query + 1168
17  postgres                            0x0000000107cfd39e PostgresMain + 2110
18  postgres                            0x0000000107c07e72 BackendRun + 50
19  postgres                            0x0000000107c07438 BackendStartup + 552
20  postgres                            0x0000000107c0621c ServerLoop + 716
21  postgres                            0x0000000107c039f9 PostmasterMain + 6441
22  postgres                            0x0000000107ae20d9 main + 809
23  libdyld.dylib                       0x00007fff2045cf3d start + 1
24  ???                                 0x0000000000000003 0x0 + 3

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION



pgsql-hackers by date:

Previous
From: Chapman Flack
Date:
Subject: Re: [PATCH] Add UPDATE WHERE OFFSET IN clause
Next
From: Thomas Munro
Date:
Subject: Re: WaitLatchOrSocket seems to not count to 4 right...