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@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
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?