BUG #1259: garbage in pg_listener after backend crash

Поиск
Список
Период
Сортировка
От PostgreSQL Bugs List
Тема BUG #1259: garbage in pg_listener after backend crash
Дата
Msg-id 20040919153931.438745A107A@www.postgresql.com
обсуждение исходный текст
Ответы Re: BUG #1259: garbage in pg_listener after backend crash  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      1259
Logged by:          Vadim Passynkov

Email address:      Vadim.Passynkov@pathcom.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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: BUG #1257: add support for 1-byte integer and 4-bit integer
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #1259: garbage in pg_listener after backend crash