pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Gaurav Srivastava <gaurav.srivastava@globallogic.com>
Cc: pgsql-odbc@postgresql.org
Subject: Re: High CPU shoot during poll retry
Date: Wed, 17 Dec 2014 15:46:45 +0200
Message-ID: <54918945.3070309@vmware.com> (raw)
In-Reply-To: <CAAXqS3CorzgfdWmNWsbvcjjXZ37F5O443S78M1m9BBEwmU-0Nw@mail.gmail.com>
References: <CAAXqS3Aag2vVu9yKQvb-jdSPuTkNSi_X6HphQcz4adgXL1gOFQ@mail.gmail.com>
	<548B569D.4040008@vmware.com>
	<CAAXqS3BFjOe8MBwprVqLwTH4BFvU55v6fGjd77XTZdj19raDuQ@mail.gmail.com>
	<5490477E.5000303@vmware.com>
	<CAAXqS3CorzgfdWmNWsbvcjjXZ37F5O443S78M1m9BBEwmU-0Nw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

On 12/17/2014 07:21 AM, Gaurav Srivastava wrote:
> Hi Heikki,
>
> Just to explain a bit more about the case "nowait==FALSE"
>
> We used this fix "Rip out broken retry/timeout logic in
> SOCK_wait_for_ready" as in few scenarios our clients also get stuck in
> infinite wait and our design is such that none of our process can wait
> little longer than few secs if this happens preventive actions are taken
> resulting re-initialization of the process.
>
>
> In order to avoid that wait situation we did slight modification i.e.
> making "nowait" TRUE everywhere in SOCK_wait_for_ready() API which resolved
> our poll() wait issue after your fix,thanks for that but later to that this
> high CPU issue has come.
>
> We resolved it using micro sleep,but still looking for a better solution,as
> we don't have much understanding of ODBC.

Ok. Well, all I can say to that is "don't do that". There isn't anything 
wrong with SOCK_wait_for_ready, as it's used in unmodified psqlodbc.

One idea is to have a separate watchdog thread or alarm signal handler, 
and if an operation takes longer than you tolerate, have the watchdog 
thread forcibly close() the socket. That will wake up the thread blocked 
on the socket. You'll still need to hack psqlodbc to get the file 
descriptor of the socket so that you can close() it, but it seems less 
risky.

- Heikki



-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



view thread (9+ messages)  latest in thread

Message-ID: <54918945.3070309@vmware.com>
Permalink:  ../54918945.3070309@vmware.com/
Also on:    postgresql.org/message-id/54918945.3070309@vmware.com

 · 

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-odbc@postgresql.org
  Cc: hlinnakangas@vmware.com, gaurav.srivastava@globallogic.com
  Subject: Re: High CPU shoot during poll retry
  In-Reply-To: <54918945.3070309@vmware.com>
  References: <CAAXqS3Aag2vVu9yKQvb-jdSPuTkNSi_X6HphQcz4adgXL1gOFQ@mail.gmail.com> <548B569D.4040008@vmware.com> <CAAXqS3BFjOe8MBwprVqLwTH4BFvU55v6fGjd77XTZdj19raDuQ@mail.gmail.com> <5490477E.5000303@vmware.com> <CAAXqS3CorzgfdWmNWsbvcjjXZ37F5O443S78M1m9BBEwmU-0Nw@mail.gmail.com> <54918945.3070309@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