Обсуждение: Backend crash in 8.2.3 with plpgsql function

Поиск
Список
Период
Сортировка

Backend crash in 8.2.3 with plpgsql function

От
SM
Дата:
I got a backend crash in Postgresql 8.2.3 with the plpgsql function.

The following statement in psql causes a signal 11:

psql=# create function testpl() returns void as 'begin return;
end;'language 'plpgsql';

The debug output is as follows:

DEBUG:  00000: StartTransactionCommand
LOCATION:  start_xact_command, postgres.c:2200
STATEMENT:  create function testpl() returns void as 'begin return;
end;'language 'plpgsql';
DEBUG:  00000: StartTransaction
LOCATION:  ShowTransactionState, xact.c:3985
STATEMENT:  create function testpl() returns void as 'begin return;
end;'language 'plpgsql';
DEBUG:  00000: name: unnamed; blockState:       DEFAULT; state:
INPROGR, xid/subid/cid: 163620/1/0, nestlvl: 1, children: <>
LOCATION:  ShowTransactionStateRec, xact.c:4010
STATEMENT:  create function testpl() returns void as 'begin return;
end;'language 'plpgsql';
DEBUG:  00000: ProcessUtility
LOCATION:  PortalRunUtility, pquery.c:1028
STATEMENT:  create function testpl() returns void as 'begin return;
end;'language 'plpgsql';
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:
DEBUG:  00000: reaping dead processes
LOCATION:  reaper, postmaster.c:2015
DEBUG:  00000: server process (PID 30164) was terminated by signal 11
LOCATION:  LogChildExit, postmaster.c:2430
LOG:  00000: server process (PID 30164) was terminated by signal 11
LOCATION:  LogChildExit, postmaster.c:2430
LOG:  00000: terminating any other active server processes
LOCATION:  HandleChildCrash, postmaster.c:2315
DEBUG:  00000: sending SIGQUIT to process 1155
LOCATION:  HandleChildCrash, postmaster.c:2366
DEBUG:  00000: sending SIGQUIT to process 4663
LOCATION:  HandleChildCrash, postmaster.c:2400
LOG:  00000: all server processes terminated; reinitializing

Here is the backtrace:

Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/libexec/ld.so...done.
Reading symbols from /usr/lib/libm.so.1.0...done.
Reading symbols from /usr/lib/libc.so.29.0...done.
Reading symbols from /usr/local/pgsql/lib/plpgsql.so...done.
#0  0x234c2a in hash_search (hashp=0x0, keyPtr=0xcfbfcc50, action=HASH_FIND,
     foundPtr=0x0) at dynahash.c:782
782             return hash_search_with_hash_value(hashp,
(gdb) bt
#0  0x234c2a in hash_search (hashp=0x0, keyPtr=0xcfbfcc50, action=HASH_FIND,
     foundPtr=0x0) at dynahash.c:782
#1  0x4038ac25 in plpgsql_HashTableLookup (func_key=0xcfbfcc50)
     at pl_comp.c:2092
#2  0x40387c8a in plpgsql_compile (fcinfo=0xcfbfce70, forValidator=1 '\001')
     at pl_comp.c:161
#3  0x40386851 in plpgsql_validator (fcinfo=0x0) at pl_handler.c:215
#4  0x231cea in OidFunctionCall1 (functionId=19370657, arg1=20155616)
     at fmgr.c:1407
#5  0x5db7c in ProcedureCreate (procedureName=0x344338 "testpl",
     procNamespace=2200, replace=0 '\000', returnsSet=0 '\000',
     returnType=2278, languageObjectId=19370658, languageValidator=19370657,
     prosrc=0x3443f0 "begin return; end;", probin=0xe8aad "-", isAgg=0 '\000',
     security_definer=0 '\000', isStrict=0 '\000', volatility=118 'v',
     parameterTypes=0xcfbfce70, allParameterTypes=0, parameterModes=0,
     parameterNames=0) at pg_proc.c:400
#6  0xe9013 in CreateFunction (stmt=0x3444d8) at functioncmds.c:652
#7  0x1ab569 in ProcessUtility (parsetree=0x3444d8, params=0x0, dest=0x344528,
     completionTag=0xcfbfd654 "") at utility.c:773
#8  0x1a9731 in PortalRunUtility (portal=0x386018, query=0x344228,
     dest=0x344528, completionTag=0xcfbfd654 "") at pquery.c:1063
#9  0x1a9861 in PortalRunMulti (portal=0x386018, dest=0x344528,
     altdest=0x344528, completionTag=0xcfbfd654 "") at pquery.c:1131
#10 0x1a9091 in PortalRun (portal=0x386018, count=2147483647, dest=0x344528,
     altdest=0x344528, completionTag=0xcfbfd654 "") at pquery.c:700
#11 0x1a3ceb in exec_simple_query (
     query_string=0x344018 "create function testpl() returns void as
'begin return; end;'language 'plpgsql';") at postgres.c:939
#12 0x1a7ced in PostgresMain (argc=4, argv=0x2e3448, username=0x2e3428 "pgsql")
     at postgres.c:3424
#13 0x17efe5 in BackendRun (port=0x2e4400) at postmaster.c:2931
#14 0x17e5a1 in BackendStartup (port=0x2e4400) at postmaster.c:2558
#15 0x17c10b in ServerLoop () at postmaster.c:1211
#16 0x17b937 in PostmasterMain (argc=3, argv=0xcfbfd984) at postmaster.c:963
#17 0x1399d9 in main (argc=3, argv=0xcfbfd984) at main.c:188

Regards,
-sm

Re: Backend crash in 8.2.3 with plpgsql function

От
Tom Lane
Дата:
SM <sm@resistor.net> writes:
> I got a backend crash in Postgresql 8.2.3 with the plpgsql function.
> The following statement in psql causes a signal 11:
> psql=# create function testpl() returns void as 'begin return;
> end;'language 'plpgsql';

Worksforme ...

            regards, tom lane

Re: Backend crash in 8.2.3 with plpgsql function

От
Alvaro Herrera
Дата:
SM wrote:

> Program terminated with signal 11, Segmentation fault.
> Reading symbols from /usr/libexec/ld.so...done.
> Reading symbols from /usr/lib/libm.so.1.0...done.
> Reading symbols from /usr/lib/libc.so.29.0...done.
> Reading symbols from /usr/local/pgsql/lib/plpgsql.so...done.
> #0  0x234c2a in hash_search (hashp=0x0, keyPtr=0xcfbfcc50, action=HASH_FIND,
>     foundPtr=0x0) at dynahash.c:782
> 782             return hash_search_with_hash_value(hashp,
> (gdb) bt
> #0  0x234c2a in hash_search (hashp=0x0, keyPtr=0xcfbfcc50, action=HASH_FIND,
>     foundPtr=0x0) at dynahash.c:782
> #1  0x4038ac25 in plpgsql_HashTableLookup (func_key=0xcfbfcc50)
>     at pl_comp.c:2092

Note that "hashp" (which is plpgsql_HashTable) is NULL here ... how can
that be?  The only way I see is that _PG_init was not called.  Maybe
there is a race condition?


--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: Backend crash in 8.2.3 with plpgsql function

От
Reece Hart
Дата:
On Thu, 2007-03-15 at 01:40 -0400, Tom Lane wrote:
> SM <sm@resistor.net> writes:
> > I got a backend crash in Postgresql 8.2.3 with the plpgsql function.
> > The following statement in psql causes a signal 11:
> > psql=# create function testpl() returns void as 'begin return;
> > end;'language 'plpgsql';
>
> Worksforme ...

Works for me too.

csb=# select version();
                                                     version
------------------------------------------------------------------------------------------------------------------
 PostgreSQL 8.2.3 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.0.2 20050901 (prerelease) (SUSE Linux)
csb=# create function testpl() returns void as 'begin return;
csb'# end;'language 'plpgsql';
CREATE FUNCTION
csb=# select testpl();
 testpl
--------

(1 row)

--
Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0
./universe -G 6.672e-11 -e 1.602e-19 -protonmass 1.673e-27 -uspres bush
kernel warning: universe consuming too many resources. Killing.
universe killed due to catastrophic leadership. Try -uspres carter.