Re: [pgsql-hackers-win32] Win32 signal code - first try

Started by Merlin Moncurealmost 22 years ago5 messages
#1Merlin Moncure
merlin.moncure@rcsonline.com

Claudio Natoli wrote:

FWIW, in a multithreaded version of postgres I'm fooling around with,

I

replaced the recv call (where backends spend most of their time

waiting)

which a select(small timeout)/SleepEx(0) "busy" loop, which calls to

recv

when ready. Works just fine.

Ok, that makes perfect sense. Simply checking pending signals in this
loop and just after a command is received will catch most of them, and
provide a suitable testing platform.

IMO, it's time for a second run of the code, and a functional test which
simulates the command processing loop which should include:

1. setjmp/longjmp stack manipulation (i.e. ELOG)
2. in process/out of process generates signals
3. all thread mechanisms.

under heavy load conditions.
We should be especially watching for deadlocks, stack corruption, and
memory leaks... If everything goes ok, I think we'll have a good
'proof of concept' signaling mechanism. After that, its time to start
submitting patches to the hackers for review...

Merlin

#2Claudio Natoli
claudio.natoli@memetrics.com
In reply to: Merlin Moncure (#1)

IMO, it's time for a second run of the code, and a functional test which
simulates the command processing loop which should include:

1. setjmp/longjmp stack manipulation (i.e. ELOG)
2. in process/out of process generates signals
3. all thread mechanisms.

Definitely. Magnus, I assume you have an interest in continuing this? (if
not, I'll gladly take it over, but I suspect you'll be wanting to ;-)

In any case, I'll independently see if I can get this mechanism wedged into
my win32 code base, and actually try it within postgres itself (when I get
the chance).

Cheers,
Claudio
--- 
Certain disclaimers and policies apply to all email sent from Memetrics.
For the full text of these disclaimers and policies see 
<a
href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em
ailpolicy.html</a>
#3Claudio Natoli
claudio.natoli@memetrics.com
In reply to: Claudio Natoli (#2)

1. setjmp/longjmp stack manipulation (i.e. ELOG)

Wrote a small program to check this out. As we hoped/assumed/expected, it
looks just fine.

Magnus, are you working on a second run at this stuff?

Cheers,
Claudio

--- 
Certain disclaimers and policies apply to all email sent from Memetrics.
For the full text of these disclaimers and policies see 
<a
href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em
ailpolicy.html</a>
#4Magnus Hagander
mha@sollentuna.net
In reply to: Claudio Natoli (#3)

1. setjmp/longjmp stack manipulation (i.e. ELOG)

Wrote a small program to check this out. As we
hoped/assumed/expected, it looks just fine.

Great!
Just checking - we're talking doing this from inside a user APC, right?

Magnus, are you working on a second run at this stuff?

Not right this moment, but I hope to do that sometime this weekend. (No
time until then).

A thought there. If we go with the "select loop" version you had tried
out and just poll (select() with short timeout, poll, loop..), do we
actually *need* the APCs *at all*? Or should we go with a pure-polling
solution? (With signals delivered on a separate thread as we discussed,
of course) The only advantage we gain by the APCs is that they will stop
the "Ex functions", no? (It's not much extra code to put it in there,
but if we don't need it..)

//Magnus

#5Claudio Natoli
claudio.natoli@memetrics.com
In reply to: Magnus Hagander (#4)

1. setjmp/longjmp stack manipulation (i.e. ELOG)

Wrote a small program to check this out. As we
hoped/assumed/expected, it looks just fine.

Great!
Just checking - we're talking doing this from inside a user APC, right?

Yes, of course! :-)

[From a user APC executing on the main thread.]

Magnus, are you working on a second run at this stuff?

Not right this moment, but I hope to do that sometime this weekend. (No

time until then).

Tell me about it [sigh].

A thought there. If we go with the "select loop" version you had tried
out and just poll (select() with short timeout, poll, loop..), do we
actually *need* the APCs *at all*? Or should we go with a pure-polling
solution? (With signals delivered on a separate thread as we discussed,
of course) The only advantage we gain by the APCs is that they will stop
the "Ex functions", no? (It's not much extra code to put it in there,
but if we don't need it..)

Hmmm, not sure. Possibly we can, although it depends on where else we might
end up needing to "wait". I'd be unreluctant to undo your good work on this
until we are sure it is safe to...

Cheers,
Claudio

--- 
Certain disclaimers and policies apply to all email sent from Memetrics.
For the full text of these disclaimers and policies see 
<a
href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em
ailpolicy.html</a>