Hello,
Here is the code change:
CheckStatementTimeout()
....
if (now >= statement_fin_time)
{
/* Time to die */
statement_timeout_active = false;
cancel_from_timeout = true;
elog(LOG, "kill PID: %d", MyProcPid);
#ifdef HAVE_SETSID_off
/* try to signal whole process group */
kill(-MyProcPid, SIGINT);
#endif
kill(MyProcPid, SIGINT);
}
....
And here is the result:
--- server.log ----
STATEMENT: FETCH 1 FROM foo;
ERROR: relation "pxtest2" does not exist at character 15
STATEMENT: SELECT * FROM pxtest2;
LOG: kill PID: 12255410 at character 15
--- ps -ef ----
tammer 12255410 16318698 0 16:14:01 - 0:00 postgres: tammer
regression [local] SELECT waiting
So the PID in CheckStatementTimeout() does match the actual backend process.
There is no difference if I use kill() with "-" or without "-".
Bye
Rainer
On 26.02.2014 15:39, Tom Lane wrote:
> Rainer Tammer <pgsql@spg.schulergroup.com> writes:
>> void
>> StatementCancelHandler(SIGNAL_ARGS)
>> {
>> int save_errno = errno;
>> elog(WARNING, "StatementCancelHandler() - entered");
>> This part is never reached. Does this mean that the signal SIGINT got lost?
> Yeah, looks that way. You might try changing the WARNING to FATAL, as
> in your previous example, just to be totally sure that it's not a problem
> of the message not getting flushed out or something like that. But what
> it seems at the moment is that the signal isn't getting delivered.
>
> It'd be an idea to add some more logging to CheckStatementTimeout to
> verify that (1) MyProcPid corresponds to the process's PID and
> (2) the kill() isn't returning an error indication. You could also
> try making it use the non-HAVE_SETSID logic, ie don't use the "-",
> just to see if that changes anything.
>
> regards, tom lane
>
>