Search Postgresql Archives

Re: Memory leak in SPI_finish call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/4/5 Jorge Arévalo <jorge.arevalo@xxxxxxxxxxxxxxxx>:
> Hello,
>
> I'm having problems with a PostgreSQL server side C-function. It's not
> an aggregate function (operates over a only row of data). When the
> function is called over tables with ~4000 rows, it causes postgres
> backend crash with SEGFAULT. I know the error is a kind of
> "cumulative", because with 3460 rows works fine, but from 3461 fails
> with SEGFAULT.
>
> Debugging, I've found the problem is a SPI_finish call. If I comment
> the call, the function ends without errors. The only problem is a
> warning message is raised, because I skipped the SPI_finish call.
>
> I'm working with postgres 8.4.7 in a Ubuntu 9.10 machine. Same problem
> in Windows machine, anyway. Things I've tried:
>
> - Quit SPI_finish call, obviously. But it's not a solution
>
> - Modify log configuration: log_min_messages=debug5,
> log_error_verbosity=verbose, log_min_error_statement=debug5,
> log_min_duration_statement=0, log_connections=on,
> log_disconnections=on, log_statment=all. I can't see any conclussion.
> Here, a log example:
> http://dl.dropbox.com/u/6599273/postgresql-2011-04-04_195420.log. The
> function that crashes is MapAlgebra.
>
> - Attach postgres process to GDB (gdb --pid=...). When I connect with
> PostgreSQL via psql/pgadmin, the backend creates 2 new processes in
> idle state, until I execute a query. One connected to the postgres
> database (I'm using postgres user) and another one connected to my
> testing database. I've tried to attach a gdb instance to both
> processes.
>
> When I attach gdb to the process connected with my testing database, I
> get :"Program exited with code 02". And no more. No core dumped. I've
> looked for that error, and looks like it depends on the software that
> caused the signal, not gdb.
>
> When I attach gdb to the process connected with postgres database, I
> get "Program received signal SIGQUIT, Quit.
> 0x00651422 in __kernel_vsyscall ()". No more information. No core dumped.
>
> So, what can I do to find the error, apart from that things? Any clue
> with the information posted above?
>
> Thanks in advance,
>
> --
> Jorge Arévalo
> Internet & Mobilty Division, DEIMOS
> jorge.arevalo@xxxxxxxxxxxxxxxx
> http://es.linkedin.com/in/jorgearevalo80
> http://mobility.grupodeimos.com/
> http://gis4free.wordpress.com
> http://geohash.org/ezjqgrgzz0g
>

Hi,

Problem solved. I was allocating memory with palloc, instead of
SPI_palloc, like specified at
http://www.postgresql.org/docs/8.4/static/spi-memory.html

Best regards,

-- 
Jorge Arévalo
Internet & Mobilty Division, DEIMOS
jorge.arevalo@xxxxxxxxxxxxxxxx
http://es.linkedin.com/in/jorgearevalo80
http://mobility.grupodeimos.com/
http://gis4free.wordpress.com
http://geohash.org/ezjqgrgzz0g

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux