On Thu, 2011-08-04 at 15:07 +0200, Hannu Krosing wrote:
> 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
Resending - the previous one was in pre-edit stage with
instructions/comments in estonian :(
> 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/
/*
Minimal scripy for reproducing the error
needed languages
LANGUAGE plpgsql
LANGUAGE plperlu
Perl module: LWP::UserAgent
Perl v5.10.0
LWP::UserAgent v5.813
NB! crash happens only with HTTPS: protocol
*/
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://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;
/*
-- now, run in at least psql 2 connectios simultaneously
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 ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers