From:
Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To:
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc:
Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject:
Re: Interruptible sleeps (was Re: CommitFest 2009-07: Yay,
Kevin! Thanks, reviewers!)
Date:
2010-09-03 02:02:25
Message-ID:
AANLkTin3OWJpUA6pzTEWyv2BvVSCz7R9U05ycJ1eYoR6@mail.gmail.com (view raw or flat )
Thread:
2010-08-18 20:40:20 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-08-18 21:21:05 from "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
2010-08-18 23:46:08 from Greg Smith <greg(at)2ndquadrant(dot)com>
2010-08-19 01:46:45 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-08-19 06:02:34 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-08-19 13:38:02 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-08-19 16:23:23 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-08-19 16:57:26 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-08-19 17:04:09 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-08-19 17:18:57 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-08-19 17:36:09 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-08-19 17:59:51 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-08-20 13:15:48 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-08-20 13:24:31 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-08-20 14:15:47 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-08-20 14:28:04 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-08-23 21:30:04 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-08-23 23:44:02 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-08-24 01:08:21 from Alvaro Herrera <alvherre(at)commandprompt(dot)com>
2010-08-24 08:42:49 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-08-26 10:40:10 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-08-27 07:39:14 from Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
2010-08-27 08:15:28 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-08-31 07:06:42 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-08-31 10:40:10 from Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
2010-08-31 12:47:51 from Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
2010-09-01 07:11:39 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-09-02 03:46:16 from Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
2010-09-02 18:30:59 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-09-02 20:13:38 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-03 02:02:25 from Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
2010-09-03 02:08:08 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-03 04:19:17 from Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
2010-09-03 14:07:25 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-03 15:43:50 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-09-03 16:10:42 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-03 16:38:52 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-09-03 20:20:46 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-09-03 21:30:14 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-09-03 22:24:18 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-04 01:19:06 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-09-05 16:58:29 from Simon Riggs <simon(at)2ndQuadrant(dot)com>
2010-09-03 21:52:05 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-05 10:44:27 from Greg Stark <gsstark(at)mit(dot)edu>
2010-09-03 19:11:58 from Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
2010-09-03 20:17:01 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-09-03 10:50:54 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-09-03 14:51:37 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-03 17:59:17 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-09-03 18:16:01 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-03 18:43:23 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-09-03 18:50:26 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-06 06:33:14 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-09-06 14:18:04 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-06 16:27:05 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-09-06 17:24:59 from Markus Wanner <markus(at)bluegap(dot)ch>
2010-09-06 18:46:30 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-06 20:10:57 from Markus Wanner <markus(at)bluegap(dot)ch>
2010-09-06 21:03:38 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-08 17:36:17 from Markus Wanner <markus(at)bluegap(dot)ch>
2010-09-08 18:01:01 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-09-08 18:18:41 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-09 08:17:18 from Markus Wanner <markus(at)bluegap(dot)ch>
2010-09-09 08:34:42 from Markus Wanner <markus(at)bluegap(dot)ch>
2010-09-07 07:01:51 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-09-07 07:06:20 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-09-07 08:22:51 from Markus Wanner <markus(at)bluegap(dot)ch>
2010-09-08 20:07:29 from Martijn van Oosterhout <kleptog(at)svana(dot)org>
2010-09-08 20:49:29 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-09 05:32:39 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-09-11 09:48:59 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-09-11 15:02:45 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-11 16:15:52 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-09-12 16:15:15 from Jeff Davis <pgsql(at)j-davis(dot)com>
2010-09-12 16:29:00 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-12 17:13:19 from Jeff Davis <pgsql(at)j-davis(dot)com>
2010-09-12 17:23:43 from Jeff Davis <pgsql(at)j-davis(dot)com>
2010-09-12 18:12:20 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-09-12 18:26:58 from Jeff Davis <pgsql(at)j-davis(dot)com>
2010-09-13 06:10:29 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-09-13 17:43:16 from Jeff Davis <pgsql(at)j-davis(dot)com>
2010-09-13 18:01:49 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
2010-08-27 21:54:05 from Greg Smith <greg(at)2ndquadrant(dot)com>
2010-08-27 22:13:11 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-08-28 01:11:53 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-08-28 01:26:15 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-08-28 01:43:36 from Greg Stark <gsstark(at)mit(dot)edu>
2010-08-28 21:00:31 from Greg Smith <greg(at)2ndquadrant(dot)com>
2010-08-31 15:40:21 from Bruce Momjian <bruce(at)momjian(dot)us>
2010-08-20 06:54:38 from tomas(at)tuxteam(dot)de
2010-08-19 15:08:38 from Alvaro Herrera <alvherre(at)commandprompt(dot)com>
2010-08-19 15:11:01 from Magnus Hagander <magnus(at)hagander(dot)net>
2010-08-19 16:16:42 from Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Lists:
pgsql-hackers
On Fri, Sep 3, 2010 at 5:13 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Does ReleaseLatch() have any actual use-case, and if so what would it be?
> I think we could do without it.
In Unix, probably we can live without that. But in Windows, we need to
free SharedEventHandles slot for upcoming process using a latch when
ending.
> The WaitLatch timeout API could use a bit of refinement. I'd suggest
> defining negative timeout as meaning wait forever, so that timeout = 0
> can be used for "check but don't wait". Also, it seems like the
> function shouldn't just return void but should return a bool to show
> whether it saw the latch set or timed out. (Yeah, I realize the caller
> could look into the latch to find that out, but callers really ought to
> treat latches as opaque structs.)
Agreed.
> I don't think you have the select-failed logic right in
> WaitLatchOrSocket; on EINTR it will suppose that FD_ISSET is a valid
> test to make, which I think ain't the case. Just "continue" around
> the loop.
EINTR already makes us go back to the top of the loop since FD_ISSET(pipe)
is not checked. Then we would clear the pipe and break out of the loop
because of "latch->is_set == true".
> + * XXX: Is it safe to elog(ERROR) in a signal handler?
>
> No, it isn't.
We should use elog(FATAL) or check proc_exit_inprogress, instead?
+ if (errno != EAGAIN && errno != EWOULDBLOCK)
+ {
+ /*
+ * XXX: Is it safe to elog(ERROR) in a signal handler?
+ */
+ elog(ERROR, "write() on self-pipe failed: %m");
+ }
+ if (errno == EINTR)
+ goto retry;
"errno == EINTR)" seems to be never checked.
Regards,
--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
In response to
Responses
pgsql-hackers by date
Next :From: Tom LaneDate: 2010-09-03 02:08:08
Subject : Re: Interruptible sleeps (was Re: CommitFest 2009-07: Yay, Kevin! Thanks, reviewers!)
Previous :From : Alvaro HerreraDate : 2010-09-02 23:17:00
Subject : Re: returning multiple result sets from a stored procedure