From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
Cc: | pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <mha(at)sollentuna(dot)net>, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: [HACKERS] pg_regress in C |
Date: | 2006-07-19 14:12:08 |
Message-ID: | 24943.1153318328@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> On Tue, Jul 18, 2006 at 10:46:04PM -0400, Tom Lane wrote:
>> ... One reason I didn't try to do this is I'm a bit hesitant to
>> write a signal handler that does anything as interesting as a system()
>> call, which would seem to be necessary to duplicate what the shell
>> script did. Comments?
> It might not actually be unsafe, given system() actually blocks on
> waitpid() which is specifically listed as a "safe" function. I'm a bit
> confused though, because system() generally sets the parent to ignore
> SIGINT which running the child process. That means the postmaster is
> being killed but pg_regress is not? If this is the case, then you won't
> be able to catch SIGINT anyway.
The cases of interest are where the (new) code goes through
spawn_process, which does a fork() and then calls system() in the
child. So the intermediate child is probably SIGINT-blocked, but
pg_regress itself isn't.
I was planning to rewrite spawn_process anyway, because I noticed that
as it's currently set up, we are actually creating four(!) processes per
parallel test: the pg_regress child, the shell invoked by system, the
psql invoked by the shell, and the connected backend. That's even worse
than the shell script, which (at least on my system) used three processes.
I believe we can get down to two (psql and backend) if spawn_process
exec's the shell instead of using system, and also puts "exec" in front
of the command string passed to the shell. So in that scenario there'd
not be any signal-blocking going on anyway.
That still leaves us with the question of whether pg_regress needs to do
anything special when signaled, though.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Susanne Ebrecht | 2006-07-19 14:13:36 | extension for sql update |
Previous Message | Phil Frost | 2006-07-19 14:05:32 | Re: lastval exposes information that currval does not |
From | Date | Subject | |
---|---|---|---|
Next Message | Susanne Ebrecht | 2006-07-19 14:13:36 | extension for sql update |
Previous Message | Zdenek Kotala | 2006-07-19 14:06:26 | Re: New regresion test for SET/RESET commnad |