Re: question about relation_open

From: Giampaolo Capelli <giampow(at)gmail(dot)com>
To: Rahila Syed <rahilasyed90(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: question about relation_open
Date: 2025-01-14 11:33:04
Message-ID: CAJ=H7uyGcKyC4z+mfbjabWk1KYXhT1FQNkVvTvi=mgz0+ccY5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi Rahila, thank you for your response,
I mean Segmentation fault, this is what I see in psql

SSL SYSCALL error: EOF detected
The connection to the server was lost. Attempting reset: Failed.
!?>

this is the content of
in /var/log/postgresql/postgresql-14-main.log when a segmentation fault
happens

2025-01-14 12:30:12.092 CET [1538] LOG: server process (PID 34594) was
terminated by signal 11: Erreur de segmentation
2025-01-14 12:30:12.092 CET [1538] DETAIL: Failed process was running:
select visualize_buffers(90);
2025-01-14 12:30:12.092 CET [1538] LOG: terminating any other active
server processes
2025-01-14 12:30:12.097 CET [1538] LOG: all server processes terminated;
reinitializing
2025-01-14 12:30:12.115 CET [34608] LOG: database system was interrupted;
last known up at 2025-01-14 10:36:29 CET
2025-01-14 12:30:12.175 CET [34610] postgres(at)postgres FATAL: the database
system is in recovery mode
2025-01-14 12:30:12.279 CET [34608] LOG: database system was not properly
shut down; automatic recovery in progress
2025-01-14 12:30:12.281 CET [34608] LOG: redo starts at 0/1CCF820
2025-01-14 12:30:12.281 CET [34608] LOG: invalid record length at
0/1CCF858: wanted 24, got 0
2025-01-14 12:30:12.281 CET [34608] LOG: redo done at 0/1CCF820 system
usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
2025-01-14 12:30:12.379 CET [1538] LOG: database system is ready to accept
connections

I don't know how to collect a core dump of postgres, I tried with gdb, but
It doesn't seem to log anything interesting

Le mar. 14 janv. 2025 à 12:27, Rahila Syed <rahilasyed90(at)gmail(dot)com> a
écrit :

> Hi,
>
>>
>>
>> I want to call the function ReadBufferExtended
>> to get the raw data of a given buffer
>> and I've read in some examples that I need to call relation_open
>> first, in order to get a Relation variable and also lock the relation.
>>
>> The function relation_open returns a non NULL pointer in my extension,
>> but then the last line in the following snippet crashes postgres.
>>
>
> You mentioned that the postgres crashes. Did you mean it caused a
> Segmentation fault or something else like PANIC?
> If possible, can you share a core dump in that case?
>
> Also, can you share any errors that you see in logs when postgres crashes?
>
> Thank you,
> Rahila Syed
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bernd Helmle 2025-01-14 11:41:38 Re: Modern SHA2- based password hashes for pgcrypto
Previous Message Rahila Syed 2025-01-14 11:26:56 Re: question about relation_open