Skip site navigation (1) Skip section navigation (2)

Re: SQLDriverConnect function call hangs

From: tamanna madaan <tamanna(dot)madaan(at)globallogic(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Re: SQLDriverConnect function call hangs
Date: 2011-11-06 11:33:16
Message-ID: CAD4qJ_JD1kiJ1OQxZM+y0+RQH-DKcYen0pfi1+LcOeD0DRjfmQ@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-odbc
Hi All

Please help me  with this issue .

Can I set connection timeout  through  SQLSetConnectAttr,
SQL_ATTR_CONNECTION_TIMEOUT ? Does psqlODBC driver  support this ??

Thanks
Tamanna
On Sun, Nov 6, 2011 at 12:14 PM, tamanna madaan <
tamanna(dot)madaan(at)globallogic(dot)com> wrote:

> Hi All
>
> I am using postgres 8.1.2 with unixODBC-2.2.11-2 and psqlodbc-08.03.0200 .
> I am having a cluster setup. Once it happened that,
> my application was trying to connect to postgres, which was lying on
> another system in cluster , and it got stuck after calling
> SQLDriverConnect function . I took a core of the hung process and the
> backtrace is as below :
>
> (gdb) bt
> #0 0xb7f1b410 in ?? ()
> #1 0xb05c4a48 in ?? ()
> #2 0xffffffff in ?? ()
> #3 0x00000001 in ?? ()
> #4 0xb7bd8dc4 in poll () from /lib/tls/libc.so.6
> #5 0xb725c7b4 in SOCK_wait_for_ready (sock=0x8b956b30, output=0,
> retry_count=1) at socket.c:529
> #6 0xb725ce9a in SOCK_get_next_byte (self=0x8b956b30, peek=0) at
> socket.c:929
> #7 0xb725d05c in SOCK_get_id (self=0x8b956b30) at socket.c:692
> #8 0xb723844d in CC_connect (self=0x8b961670, password_req=0 '\0',
> salt_para=0xb05c6130 "") at connection.c:1600
> #9 0xb72459f8 in PGAPI_DriverConnect (hdbc=0x8b961670, hwnd=0x0,
> szConnStrIn=0xfffffffc <Address 0xfffffffc out of bounds>, cbConnStrIn=50,
> szConnStrOut=0xb05ca790 "", cbConnStrOutMax=4096,
> pcbConnStrOut=0xb05ca38e, fDriverCompletion=0) at drvconn.c:225
> #10 0xb7270d1f in SQLDriverConnect (hdbc=0x8b961670, hwnd=0xfffffffc,
> szConnStrIn=0xfffffffc <Address 0xfffffffc out of bounds>, cbConnStrIn=50,
> szConnStrOut=0xfffffffc <Address 0xfffffffc out of bounds>,
> cbConnStrOutMax=4096, pcbConnStrOut=0xfffffffc, fDriverCompletion=0) at
> odbcapi.c:225
> #11 0xb7d2aa88 in SQLDriverConnect (hdbc=0x87b67130, hwnd=0x0,
> conn_str_in=0x892520c "SERVERNAME=172.16.1.1;DSN=abc;DATABASE=abc;UID=abc",
> len_conn_str_in=50,
> conn_str_out=0xb05ca790 "", conn_str_out_max=4096,
> ptr_conn_str_out=0xb05ca38e, driver_completion=0) at SQLDriverConnect.c:1155
>
> After analysing the issue, I found that the system, on which postgres was
> running, was overloaded. Its CPU usage was almost 100 % and may be thats
> why it wasn't responding to
> the  SQLDriverConnect request . Later  on the system (on which postgres
> was running) was rebooted . Now my questions are  :
>
> 1, why SQLDriverConnect  function call got hung.
> 2. Why didn't it simply return with some error code when it wasn't able to
> connect to postgres ( as it wasnt responding because of system load.)
> 3. Why it still didnt return when the system was rebooted ??
> 4. What can be done to make SQLDriverConnect function return with error
> in case it is not able to connect to postgres for whatsoever reason.
> 5. Can connection timeout be set through  SQLSetConnectAttr,
> SQL_ATTR_CONNECTION_TIMEOUT to make SQLDriverConnect  return after certain
> amount of time in case there
> is no response from postgres ?? how can this be done ??
> 6. Is there any other better way to overcome this issue ??
>
> Thanks...
> --
> Tamanna Madaan | Associate Consultant | GlobalLogic Inc.
> Leaders in Software R&D Services
> ARGENTINA | CHILE | CHINA | GERMANY | INDIA | ISRAEL | UKRAINE | UK | USA
>
> Office: +0-120-406-2000 x 2971
>
> www.globallogic.com
>
>
>


-- 
Tamanna Madaan | Associate Consultant | GlobalLogic Inc.
Leaders in Software R&D Services
ARGENTINA | CHILE | CHINA | GERMANY | INDIA | ISRAEL | UKRAINE | UK | USA

Office: +0-120-406-2000 x 2971

www.globallogic.com

In response to

pgsql-odbc by date

Next:From: BGoebelDate: 2011-11-07 15:11:33
Subject: Fetch absolute returns OK when fetching a nonexistent row
Previous:From: Boszormenyi ZoltanDate: 2011-11-06 08:11:33
Subject: Re: Locale problem with psqlODBC under Fedora 16

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group