Hi

I have been helping some people to debug a SIGALARM related crash
induced by using pl/perlu http get functionality

I have been so far able to repeat the crash only on Debian 64 bit
computers. DB create script and instructions for reproducing the crash
attached

The crash is related to something leaving begind a bad SIGALARM handler,
as it can be (kind of) fixed by resetting sigalarm to nothing using perl
function 

REATE OR REPLACE FUNCTION reset_sigalarm() RETURNS VOID
    LANGUAGE plperlu
AS $_X$
   $SIG{ALRM} = 'IGNORE';
$_X$;

( unfortunately this hoses deadlock detection and statement_timeout )

Environment where this crash does happen:

Debian GNU/Linux 6.0  - x86-64
openssl                 0.9.8o-4squeeze1
postgresql-9.0          9.0.4-1~bpo60+1 
postgresql-plperl-9.0   9.0.4-1~bpo60+1 
libwww-perl             5.836-1      

Postgresql is installed from backports

It does not happen on 32 bit ubuntu


-- 
-------
Hannu Krosing
PostgreSQL Infinite Scalability and Performance Consultant
PG Admin Book: http://www.2ndQuadrant.com/books/
/*
Minimaalne komplekt vea reprodutseerimiseks:
Postgre andmebaas
LANGUAGE plpgsql
LANGUAGE plperlu
Perli moodul: LWP::UserAgent
Perl v5.10.0
LWP::UserAgent v5.813

Crashi reprodutseerimiseks tuleb kasutada HTTPS päringu.
*/

CREATE TABLE crashtest
(
  id integer,
  val varchar
);

INSERT INTO crashtest (id, val) VALUES (1, '');

CREATE OR REPLACE FUNCTION crashtest()
  RETURNS character varying AS
$BODY$
begin
perform crashtest_request();
update crashtest set val = 'XXX' where id=1;
perform pg_sleep(2);
RETURN 'OK';
END;
$BODY$
  LANGUAGE plpgsql VOLATILE SECURITY DEFINER;

CREATE OR REPLACE FUNCTION crashtest_request()
  RETURNS text AS
$BODY$
use strict;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
# my $req = HTTP::Request->new(GET => 'https://www.eesti.ee/est/'); # Peab olema https ! 
my $req = HTTP::Request->new(GET => 'https://encrypted.google.com/'); 
# my $req = HTTP::Request->new(GET => 'https://www.paypal.com/ee/'); 
my $res = $ua->request($req);
return 'OK';
$BODY$
  LANGUAGE plperlu VOLATILE;

/*
-- Vähemalt kahes SQL aknas tuleb paralleelselt käivitada:
select crashtest();
select crashtest();
select crashtest();
select crashtest();
select crashtest();
select crashtest();
select crashtest();
select crashtest();
select crashtest();
select crashtest();
select crashtest();
select crashtest();
*/


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

Reply via email to