BUG #1259: garbage in pg_listener after backend crash

From: "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1259: garbage in pg_listener after backend crash
Date: 2004-09-19 15:39:31
Message-ID: 20040919153931.438745A107A@www.postgresql.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1259
Logged by: Vadim Passynkov

Email address: Vadim(dot)Passynkov(at)pathcom(dot)com

PostgreSQL version: 7.4.5

Operating system: FreeBSD 4.10-STABLE

Description: garbage in pg_listener after backend crash

Details:

If current backend crash after registers on the notification condition
<name> ( 'LISTEN <name>' SQL command ) row in the pg_listener still exists;

======================================================
template1=# SELECT pg_backend_pid ();
pg_backend_pid
----------------
6312
(1 row)

template1=# LISTEN test;
LISTEN

template1=# SELECT * from pg_listener where listenerpid = 6312;
relname | listenerpid | notification
---------+-------------+--------------
test | 6312 | 0
(1 row)

template1=# SELECT crash_backend ( );
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

!> \c template1 pgsql
You are now connected to database "template1" as user "pgsql".
template1=# SELECT * from pg_listener where listenerpid = 6312;
relname | listenerpid | notification
---------+-------------+--------------
test | 6312 | 0
(1 row)

======================================================

/* crash_backend.c */
#include "postgres.h"
#include "executor/spi.h"

PG_FUNCTION_INFO_V1 ( crash_backend );
Datum crash_backend ( PG_FUNCTION_ARGS ) {
char *ptr = NULL;

*ptr = '1';
PG_RETURN_INT32 ( 1 );
}

======================================================

cc -Wall -fpic -I/usr/local/include/postgresql/server -I/usr/local/include
-c crash_backend.c -o crash_backend.o
cc -shared -o crash_backend.so crash_backend.o

======================================================

CREATE OR REPLACE FUNCTION crash_backend ( ) RETURNS integer AS
'/usr/home/pvi/pg_bug/crash_backend.so', 'crash_backend' LANGUAGE 'C';

======================================================

--
Vadim Passynkov

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-09-19 16:34:37 Re: BUG #1259: garbage in pg_listener after backend crash
Previous Message Peter Eisentraut 2004-09-18 14:07:20 Re: BUG #1257: add support for 1-byte integer and 4-bit integer