From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Magnus Hagander" <mha(at)sollentuna(dot)net> |
Cc: | "Andrew Dunstan" <andrew(at)dunslane(dot)net>, "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>, pgsql-hackers(at)postgresql(dot)org, "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com> |
Subject: | Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance |
Date: | 2005-10-22 15:46:50 |
Message-ID: | 1570.1129996010@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
"Magnus Hagander" <mha(at)sollentuna(dot)net> writes:
> Agreed. I definitly vote for backing out the patch so we don't block the
> release. If we find the problem we put it back in before release, but if
> it takes a while we just wait for 8.2.
After digging in the Microsoft documentation a little bit, I think I
see the problem: we implement SIGALRM timeouts by means of a "waitable
timer", and the system's action when the timeout expires is:
When a timer expires, the timer is set to the signaled state. If
the timer has a completion routine, it is queued to the thread
that set the timer. The completion routine remains in the APC
queue of the thread until the threads enters an alertable wait
state. At that time, the APC is dispatched and the completion
routine is called.
In other words, since the main thread is the one that set the timer,
it has to run the completion routine (which just sets the signal flag).
The completion routine will never be run if the main thread is in a
tight loop with no kernel calls. In particular, it was the frequent
execution of WaitForSingleObjectEx via CHECK_FOR_INTERRUPTS that allowed
this technique to work at all.
Isn't there some way we can get the timer completion routine to be run
by the signal thread instead? This coding seems pretty unreliable to me
even without QQ's patch.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Paul Lindner | 2005-10-22 15:48:27 | Differences in UTF8 between 8.0 and 8.1 |
Previous Message | Andrew Dunstan | 2005-10-22 15:40:42 | Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance |