pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@2ndquadrant.com>
Cc: Igor <igorya.inscriptio@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7670: BUG #7545: Unresponsive server with error log reporting: "poll() failed: Invalid argument"
Date: Sun, 18 Nov 2012 14:19:07 -0500
Message-ID: <5168.1353266347@sss.pgh.pa.us> (raw)
In-Reply-To: <20121118191349.GB1325@awork2.anarazel.de>
References: <20121118162852.GB14145@awork2.anarazel.de>
	<CALdM5eqgGyGChJWxmtbyuWeZ363mmMCmx9JfrWNgp3HjHKv3-A@mail.gmail.com>
	<CALdM5eqo5ADe5qe54KqPJK4r-99H4X8vWz41grTiLUpqoxg1gw@mail.gmail.com>
	<3078.1353259769@sss.pgh.pa.us>
	<CALdM5ep0oJXGW6sQd5nJX5T8J1P4WsK0gM6O-oCfheY+Yy4vAg@mail.gmail.com>
	<3366.1353260695@sss.pgh.pa.us>
	<20121118180654.GB30822@awork2.anarazel.de>
	<4024.1353262722@sss.pgh.pa.us>
	<20121118185102.GA1325@awork2.anarazel.de>
	<4924.1353265657@sss.pgh.pa.us>
	<20121118191349.GB1325@awork2.anarazel.de>

Andres Freund <andres@2ndquadrant.com> writes:
> On 2012-11-18 14:07:37 -0500, Tom Lane wrote:
>> Anyway, even if Linux for some reason doesn't reject negative values,
>> I think we need to limit the GUC's range so we don't try to use them.
>> Maybe you'd get sane behavior and maybe you wouldn't.  I notice that
>> the Single Unix Spec doesn't specify EINVAL for negative timeout
>> values, but it also doesn't define what happens for a negative value
>> other than -1.  So this is basically an unspecified case and it's
>> incumbent on us to not do it if we want portable behavior.

> I aggree that we need to do something. I just think it might be enough
> to clamp the timeout value passed to WaitLatchOrSocket to the maximum
> valid value. The rest of SysLoggerMain seems to work correctly in that
> case.

This seems a rather 64-bit-centric view of the world.  If "long" is
32 bits, the value will have overflowed before it ever gets to
WaitLatch.

I'm thinking it might be reasonable to put an Assert(timeout <= INT_MAX)
into WaitLatch, since we're already asserting timeout >= 0.  But adding
a run-time clamp is not sufficient to fix the problem, because if any
overflow happens it's happening upstream.

			regards, tom lane




view thread (28+ messages)

Message-ID: <5168.1353266347@sss.pgh.pa.us>
Permalink:  ../5168.1353266347@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5168.1353266347@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andres@2ndquadrant.com, igorya.inscriptio@gmail.com
  Subject: Re: BUG #7670: BUG #7545: Unresponsive server with error log reporting: "poll() failed: Invalid argument"
  In-Reply-To: <5168.1353266347@sss.pgh.pa.us>
  References: <20121118162852.GB14145@awork2.anarazel.de> <CALdM5eqgGyGChJWxmtbyuWeZ363mmMCmx9JfrWNgp3HjHKv3-A@mail.gmail.com> <CALdM5eqo5ADe5qe54KqPJK4r-99H4X8vWz41grTiLUpqoxg1gw@mail.gmail.com> <3078.1353259769@sss.pgh.pa.us> <CALdM5ep0oJXGW6sQd5nJX5T8J1P4WsK0gM6O-oCfheY+Yy4vAg@mail.gmail.com> <3366.1353260695@sss.pgh.pa.us> <20121118180654.GB30822@awork2.anarazel.de> <4024.1353262722@sss.pgh.pa.us> <20121118185102.GA1325@awork2.anarazel.de> <4924.1353265657@sss.pgh.pa.us> <20121118191349.GB1325@awork2.anarazel.de> <5168.1353266347@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox