plperlu function caused a segmentation fault

From: bricklen <bricklen(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: plperlu function caused a segmentation fault
Date: 2011-08-24 16:22:21
Message-ID: CAGrpgQ-Yx74V1TP5mDiA8wikUviFzANbV9W3K-Q11sYLM28WXg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I was just testing a simple plperlu function to return the existence
of a directory and as soon I pasted the function into psql and hit
Enter, I got the following crash:

CREATE OR REPLACE FUNCTION does_directory_exist(p_path_and_directory
TEXT, OUT does_it_exist TEXT)
RETURNS TEXT AS
$BODY$

my $path_and_directory = shift(@_);
my $does_it_exist = 'false';

if ( -d "$path_and_directory" ) {
$does_it_exist = "true";
}

return "$does_it_exist";

$BODY$ LANGUAGE plperlu VOLATILE COST 100 SECURITY DEFINER;

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.

Excerpt from the log

2011-08-24 08:55:57 PDT [25795]: [448-1] (user=) (rhost=) LOG: server
process (PID 9474) was terminated by signal 11: Segmentation fault
2011-08-24 08:55:57 PDT [25795]: [449-1] (user=) (rhost=) LOG:
terminating any other active server processes
2011-08-24 08:55:57 PDT [10309]: [21-1] (user=nbaffnet)
(rhost=192.168.96.183) WARNING: terminating connection because of
crash of another server process
2011-08-24 08:55:57 PDT [10309]: [22-1] (user=nbaffnet)
(rhost=192.168.96.183) DETAIL: The postmaster has commanded this
server process to roll back the current transaction and exit, because
another server process exited abnormally and possibly corrupted shared
memory.
2011-08-24 08:55:57 PDT [10309]: [23-1] (user=nbaffnet)
(rhost=192.168.96.183) HINT: In a moment you should be able to
reconnect to the database and repeat your command.
...
2011-08-24 08:55:58 PDT [25795]: [451-1] (user=) (rhost=) LOG: all
server processes terminated; reinitializing
2011-08-24 08:56:00 PDT [14436]: [1-1] (user=nbaffnet)
(rhost=192.168.96.202) FATAL: the database system is in recovery mode
2011-08-24 08:56:00 PDT [14437]: [1-1] (user=postgres) (rhost=[local])
FATAL: the database system is in recovery mode
2011-08-24 08:56:00 PDT [14441]: [1-1] (user=nbaffnet)
(rhost=192.168.96.201) FATAL: the database system is in recovery mode
2011-08-24 08:56:00 PDT [14447]: [1-1] (user=nbaffnet)
(rhost=192.168.96.200) FATAL: the database system is in recovery mode
2011-08-24 08:56:00 PDT [14446]: [1-1] (user=nbaffnet)
(rhost=192.168.96.200) FATAL: the database system is in recovery mode
2011-08-24 08:56:00 PDT [14435]: [1-1] (user=) (rhost=) LOG: database
system was interrupted; last known up at 2011-08-24 08:55:13 PDT
2011-08-24 08:56:00 PDT [14435]: [2-1] (user=) (rhost=) LOG: database
system was not properly shut down; automatic recovery in progress
2011-08-24 08:56:00 PDT [14435]: [3-1] (user=) (rhost=) LOG:
consistent recovery state reached at 3A3B/CCFBD7C8
2011-08-24 08:56:00 PDT [14435]: [4-1] (user=) (rhost=) LOG: redo
starts at 3A3B/C7321A10
...

select * from pg_language ;
lanname | lanowner | lanispl | lanpltrusted | lanplcallfoid |
laninline | lanvalidator | lanacl
----------+----------+---------+--------------+---------------+-----------+--------------+--------
internal | 10 | f | f | 0 |
0 | 2246 |
c | 10 | f | f | 0 |
0 | 2247 |
sql | 10 | f | t | 0 |
0 | 2248 |
plperl | 10 | t | t | 16545 |
16546 | 16547 |
plperlu | 10 | t | f | 16545 |
16546 | 16547 |
plpgsql | 10 | t | t | 11571 |
11572 | 11573 |
(6 rows)

select version();
version
-------------------------------------------------------------------------------------------------------------------
PostgreSQL 9.0.2 on x86_64-unknown-linux-gnu, compiled by GCC gcc
(GCC) 4.1.2 20080704 (Red Hat 4.1.2-48), 64-bit

Are there any known bugs with plperlu and 9.0.2? I did a quick search
of the archives and the only somewhat-relevant report I could find was
http://markmail.org/message/iib5eu7qgtazaorg

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2011-08-24 16:30:06 Re: Streaming Replication: Observations, Questions and Comments
Previous Message Greg Smith 2011-08-24 16:21:57 Re: question regarding full_page_write