From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Gaurav Srivastava <gaurav.srivastava@globallogic.com>
To: pgsql-odbc@postgresql.org
Subject: Re: High CPU shoot during poll retry
Date: Fri, 12 Dec 2014 22:57:01 +0200
Message-ID: <548B569D.4040008@vmware.com> (raw)
In-Reply-To: <CAAXqS3Aag2vVu9yKQvb-jdSPuTkNSi_X6HphQcz4adgXL1gOFQ@mail.gmail.com>
References: <CAAXqS3Aag2vVu9yKQvb-jdSPuTkNSi_X6HphQcz4adgXL1gOFQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>
On 12/12/2014 12:31 PM, Gaurav Srivastava wrote:
> Hi All,
>
> In ODBC library later to change done as part of commit Title "Rip out
> broken retry/timeout logic in SOCK_wait_for_ready." in file socket.c
>
> Now the cpde snippet for SOCK_wait_for_ready() is like:
>
> do {
> #ifdef HAVE_POLL
> fds.fd = sock->socket;
> fds.events = output ? POLLOUT : POLLIN;
> fds.revents = 0;
> * ret = poll(&fds, 1, nowait ? 0 : -1); *
> mylog("!!! poll ret=%d revents=%x\n", ret, fds.revents);
> #else
> FD_ZERO(&fds);
> FD_ZERO(&except_fds);
> FD_SET(sock->socket, &fds);
> FD_SET(sock->socket, &except_fds);
> if (nowait)
> {
> tm.tv_sec = 0;
> tm.tv_usec = 0;
> }
> ret = select((int) sock->socket + 1, output ? NULL : &fds,
> output ? &fds : NULL, &except_fds, nowait ? &tm : NULL);
> #endif /* HAVE_POLL */
> gerrno = SOCK_ERRNO;
> } *while (ret < 0 && EINTR == gerrno);*
>
>
>
> So whenever there is no fd is ready to be read it will immediately return
> and solve the issue of infinite query hung but due to immediate return it
> will go for continuous retries and causing CPU to shoot very high.This is
> one of the case we are suffering in our scenario after upgrading ODBC.
Why do you think it will go into continuous retries?
- Heikki
--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
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-odbc@postgresql.org
Cc: hlinnakangas@vmware.com, gaurav.srivastava@globallogic.com
Subject: Re: High CPU shoot during poll retry
In-Reply-To: <548B569D.4040008@vmware.com>
References: <CAAXqS3Aag2vVu9yKQvb-jdSPuTkNSi_X6HphQcz4adgXL1gOFQ@mail.gmail.com> <548B569D.4040008@vmware.com>
* 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