pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedPostgreSQL 9.0.2. This is a Bug?
4+ messages / 2 participants
[nested] [flat]
* PostgreSQL 9.0.2. This is a Bug?
@ 2011-01-14 21:45 Fabricio <fabrixio1@hotmail.com>
2011-01-14 22:41 ` Re: PostgreSQL 9.0.2. This is a Bug? Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 4+ messages in thread
From: Fabricio @ 2011-01-14 21:45 UTC (permalink / raw)
To: pgsql-admin
This is a bug?
A developer is writing a function in C code and when he makes some change and replace the old library with the new one and if run CREATE OR REPLACE FUNCTION Postgre crash and restart. After restart CREATE OR REPLACE FUNCTION does not crash postgres, only the first time. He makes a function test.
Function's Sorce code:
#include "postgres.h"
#include "fmgr.h"
#include <sys/utsname.h>
#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif
PG_FUNCTION_INFO_V1(testfuncion);
Datum testfuncion( PG_FUNCTION_ARGS )
{
int32 iParam01,
iParam02;
char cTexto[30]={0};
iParam01 = PG_GETARG_INT32(0);
iParam02 = PG_GETARG_INT32(1);
sprintf(cTexto, "iParam01: %i iParam02: %i", iParam01, iParam02 );
elog( NOTICE, cTexto );
PG_RETURN_INT32(iParam01 * -1);
}
makefile:
CC = gcc
CFLAGS = -fPIC
CPPFLAGS = -I/usr/include -I/usr/local/pgsql/include/server/ -I/usr/local/include -I./
all:
rm -f *.o
rm -f *.so
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o ./bin/testFuncion.o testFuncion.c
$(CC) $(CFLAGS) $(CPPFLAGS) -shared -o ./bin/testFuncion.so ./bin/testFuncion.o
@cp ./bin/testFuncion.so /somefolder/testFuncion.so
@echo " "
@echo OK ... Compilado ... OK
@echo " "
PostgreSQL' logs:
<2011-01-14 12:52:49 MST 10.43.69.141(55946) somedb someuser 18484 idle 64> DEBUG: StartTransactionCommand
<2011-01-14 12:52:49 MST 10.43.69.141(55946) somedb someuser 18484 idle 65> DEBUG: StartTransaction
<2011-01-14 12:52:49 MST 10.43.69.141(55946) somedb someuser 18484 idle 66> DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
<2011-01-14 12:52:49 MST 10.43.69.141(55946) somedb someuser 18484 idle 67> LOG: statement: CREATE OR REPLACE FUNCTION testfuncion(integer,integer)
RETURNS int AS
'/somefolder/testFuncion.so', 'testfuncion'
LANGUAGE c IMMUTABLE STRICT;
<2011-01-14 12:52:49 MST 10.43.69.141(55946) somedb someuser 18484 CREATE FUNCTION 68> DEBUG: ProcessUtility
<2011-01-14 12:52:49 MST 18297 654> DEBUG: reaping dead processes
<2011-01-14 12:52:49 MST 18297 655> DEBUG: server process (PID 18484) was terminated by signal 11: Segmentation fault
<2011-01-14 12:52:49 MST 18297 656> LOG: server process (PID 18484) was terminated by signal 11: Segmentation fault
<2011-01-14 12:52:49 MST 18297 657> LOG: terminating any other active server processes
=
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: PostgreSQL 9.0.2. This is a Bug?
2011-01-14 21:45 PostgreSQL 9.0.2. This is a Bug? Fabricio <fabrixio1@hotmail.com>
@ 2011-01-14 22:41 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2011-01-14 22:41 UTC (permalink / raw)
To: Fabricio <fabrixio1@hotmail.com>; +Cc: pgsql-admin
Fabricio <fabrixio1@hotmail.com> writes:
> A developer is writing a function in C code and when he makes some change and replace the old library with the new one and if run CREATE OR REPLACE FUNCTION Postgre crash and restart. After restart CREATE OR REPLACE FUNCTION does not crash postgres, only the first time. He makes a function test.
You didn't say what platform this is, but overwriting an actively-used
.so file isn't a safe thing to do on all systems. There's nothing
Postgres can do about that.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: PostgreSQL 9.0.2. This is a Bug?
@ 2011-01-14 22:53 Fabricio <fabrixio1@hotmail.com>
2011-01-14 23:06 ` Re: PostgreSQL 9.0.2. This is a Bug? Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 4+ messages in thread
From: Fabricio @ 2011-01-14 22:53 UTC (permalink / raw)
To: tgl@sss.pgh.pa.us; +Cc: pgsql-admin
Linux Slackware 13.1gcc 4.5.1
This .so files works fine in older postgres's versions.Postgres has support for this, but postgres team says do not use it?
thanks tom, regards...
> To: fabrixio1@hotmail.com
> CC: pgsql-admin@postgresql.org
> Subject: Re: [ADMIN] PostgreSQL 9.0.2. This is a Bug?
> Date: Fri, 14 Jan 2011 17:41:31 -0500
> From: tgl@sss.pgh.pa.us
>
> Fabricio <fabrixio1@hotmail.com> writes:
> > A developer is writing a function in C code and when he makes some change and replace the old library with the new one and if run CREATE OR REPLACE FUNCTION Postgre crash and restart. After restart CREATE OR REPLACE FUNCTION does not crash postgres, only the first time. He makes a function test.
>
> You didn't say what platform this is, but overwriting an actively-used
> .so file isn't a safe thing to do on all systems. There's nothing
> Postgres can do about that.
>
> regards, tom lane
=
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: PostgreSQL 9.0.2. This is a Bug?
2011-01-14 22:53 Re: PostgreSQL 9.0.2. This is a Bug? Fabricio <fabrixio1@hotmail.com>
@ 2011-01-14 23:06 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2011-01-14 23:06 UTC (permalink / raw)
To: Fabricio <fabrixio1@hotmail.com>; +Cc: pgsql-admin
Fabricio <fabrixio1@hotmail.com> writes:
> Linux Slackware 13.1gcc 4.5.1
> This .so files works fine in older postgres's versions.Postgres has support for this, but postgres team says do not use it?
It's not whether the .so works, it's whether you can overwrite it while
it's already open in some process. I think you'll find that that
crashes any version of Postgres, or most other programs too. A bit of
googling turns up references like these:
http://www.mail-archive.com/um-linux@listserv.umd.edu/msg02922.html
http://stackoverflow.com/questions/3855004/overwriting-library-file-causes-segmentation-fault
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2011-01-14 23:06 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-01-14 21:45 PostgreSQL 9.0.2. This is a Bug? Fabricio <fabrixio1@hotmail.com>
2011-01-14 22:41 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-01-14 22:53 Re: PostgreSQL 9.0.2. This is a Bug? Fabricio <fabrixio1@hotmail.com>
2011-01-14 23:06 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox