Re: [HACKERS] rare avl shutdown slowness (related to signal handling)

2015-04-07 Thread Qingqing Zhou
On Tue, Apr 7, 2015 at 4:01 PM, Tom Lane wrote: > > Indeed, which is why I think a patch for this issue should not introduce > a new mode/context in which proc_exit() is executed. Agree. Along this line, we can add an on_proc_exit hook simply ereport("we are exiting") there. In this way, we reuse

Re: [HACKERS] rare avl shutdown slowness (related to signal handling)

2015-04-07 Thread Tom Lane
Qingqing Zhou writes: > I do feel that we have too many functions instructing how to handle > interrupts and they are subtle - I just found a new friend > HOLD_CANCEL_INTERRUPTS :-( Indeed, which is why I think a patch for this issue should not introduce a new mode/context in which proc_exit() is

Re: [HACKERS] rare avl shutdown slowness (related to signal handling)

2015-04-07 Thread Qingqing Zhou
On Tue, Apr 7, 2015 at 2:32 PM, Tom Lane wrote: > That seems like (a) a hack, and (b) not likely to solve the problem > completely, unless you leave interrupts held throughout proc_exit(), > which would create all sorts of opportunities for corner case bugs > during on_proc_exit hooks. > Hmm, loo

Re: [HACKERS] rare avl shutdown slowness (related to signal handling)

2015-04-07 Thread Tom Lane
Alvaro Herrera writes: > Tom Lane wrote: >> I think changing the outer "for(;;)" to "while (!got_SIGTERM)" would >> be a much safer fix. > Ah, yeah. I was thinking in changing PG_exception_stack once shutdown > was requested, but this is much simpler. Your proposed patch seems to be doing both

Re: [HACKERS] rare avl shutdown slowness (related to signal handling)

2015-04-07 Thread Tom Lane
Qingqing Zhou writes: > I got another repro with the shutdown slowness (DEBUG5 with verbosed > log are attached). > It gives a finer picture of what's going on: > 1. Avl ereport("autovacuum launcher shutting down"); > 2. At the end of errfinish(), it honors a pending SIGINT; > 3. SIGINT handler

Re: [HACKERS] rare avl shutdown slowness (related to signal handling)

2015-04-07 Thread Qingqing Zhou
I got another repro with the shutdown slowness (DEBUG5 with verbosed log are attached). It gives a finer picture of what's going on: 1. Avl ereport("autovacuum launcher shutting down"); 2. At the end of errfinish(), it honors a pending SIGINT; 3. SIGINT handler longjmp to the start of avl error h

[HACKERS] rare avl shutdown slowness (related to signal handling)

2015-04-07 Thread Qingqing Zhou
I am playing git tip on windows 7/32 bits, with the backend compiled with visual studio 2005 (I know, it is very old :-( ). I encountered avl shutdown slowness twice, last night and this morning: after a ctrl_c is hit, wait for another 60 seconds, server shuts down. Here is one log: D:\pgsql\bin>