Re: BUG #18832: Segfault in GrantLockLocal
Robins Tharakan <tharakan@gmail.com>
From: Robins Tharakan <tharakan@gmail.com>
To: Álvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Richard Guo <guofenglinux@gmail.com>, pgsql-bugs@lists.postgresql.org, Heikki Linnakangas <hlinnaka@iki.fi>
Date: 2025-03-27T09:42:27Z
Lists: pgsql-bugs
On Fri, 7 Mar 2025 at 21:07, Álvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>
>
> One way to capture this might be to run the problem workload under rr
> enough times until it reproduces, and then it can then be replayed under
> the debugger.
>
>
https://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Linux/BSD#Recording_Postgres_using_rr_Record_and_Replay_Framework
>
Thanks Álvaro / Richard for the pointers.
Initially that seemed like some work for rare segfaults, and although
it's still a hit or miss, I now see that when it rains it pours (all these
ROLLBACKs have the same backtrace), and so does appear worth
the effort to track further. Pasting what I already have.
I'll try rr, and update if I find something.
$ grep "Failed process was running" logfile | grep -v MERGE | grep -v
select | grep -v SELECT
grep: logfile: binary file matches
2025-03-17 01:58:10.682 ACDT [190142] DETAIL: Failed process was running:
ROLLBACK;
2025-03-17 06:36:52.796 ACDT [190142] DETAIL: Failed process was running:
ROLLBACK;
2025-03-17 09:17:35.950 ACDT [190142] DETAIL: Failed process was running:
insert into public.test_range_gist ( ir ) values (
2025-03-17 10:29:32.296 ACDT [190142] DETAIL: Failed process was running:
ROLLBACK;
2025-03-17 10:36:30.187 ACDT [190142] DETAIL: Failed process was running:
ROLLBACK;
2025-03-17 22:12:17.090 ACDT [190142] DETAIL: Failed process was running:
ROLLBACK;
2025-03-17 22:23:26.155 ACDT [190142] DETAIL: Failed process was running:
ROLLBACK;
2025-03-19 08:24:08.434 ACDT [2357560] DETAIL: Failed process was running:
ROLLBACK;
2025-03-19 08:53:49.066 ACDT [2357560] DETAIL: Failed process was running:
ROLLBACK;
2025-03-25 01:07:30.666 ACDT [4338] DETAIL: Failed process was running:
ROLLBACK;
2025-03-25 06:27:50.560 ACDT [4338] DETAIL: Failed process was running:
ROLLBACK;
Core was generated by `postgres: 44fe6ceb51f@sqith: u8 postgres
127.0.0.1(37802) ROLLBACK '.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00005fbb793422d6 in GrantLockLocal (locallock=0x5fbba9c35c38,
owner=0x5fbba9b419d8) at lock.c:1805
1805 lockOwners[i].owner = owner;
(gdb) bt
#0 0x00005fbb793422d6 in GrantLockLocal (locallock=0x5fbba9c35c38,
owner=0x5fbba9b419d8) at lock.c:1805
#1 0x00005fbb79342546 in GrantAwaitedLock () at lock.c:1887
#2 0x00005fbb7935654e in LockErrorCleanup () at proc.c:814
#3 0x00005fbb78e54fb2 in AbortTransaction () at xact.c:2853
#4 0x00005fbb78e55781 in CommitTransactionCommandInternal () at xact.c:3275
#5 0x00005fbb78e555f0 in CommitTransactionCommand () at xact.c:3163
#6 0x00005fbb7936a05c in finish_xact_command () at postgres.c:2834
#7 0x00005fbb7936744e in exec_simple_query (query_string=0x5fbba9b030b0
"ROLLBACK;") at postgres.c:1298
#8 0x00005fbb7936cbf3 in PostgresMain (dbname=0x5fbba9b44258 "postgres",
username=0x5fbba9b44240 "u8") at postgres.c:4757
#9 0x00005fbb79362779 in BackendMain (startup_data=0x7ffc6f57c3e0,
startup_data_len=24) at backend_startup.c:122
#10 0x00005fbb79265e5a in postmaster_child_launch (child_type=B_BACKEND,
child_slot=299, startup_data=0x7ffc6f57c3e0, startup_data_len=24,
client_sock=0x7ffc6f57c440)
at launch_backend.c:291
#11 0x00005fbb7926c9fa in BackendStartup (client_sock=0x7ffc6f57c440) at
postmaster.c:3580
#12 0x00005fbb79269e14 in ServerLoop () at postmaster.c:1701
#13 0x00005fbb7926970a in PostmasterMain (argc=3, argv=0x5fbba9abcab0) at
postmaster.c:1399
#14 0x00005fbb79108b07 in main (argc=3, argv=0x5fbba9abcab0) at main.c:230
-
robins
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix crash if LockErrorCleanup() is called twice
- 51a0382e8d87 18.0 landed
-
Split ProcSleep function into JoinWaitQueue and ProcSleep
- 3c0fd64fec8e 18.0 cited