pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
crash bug on closed connection
9+ messages / 2 participants
[nested] [flat]

* crash bug on closed connection
@ 2014-10-13 21:02  Jade Koskela <jkoskela0@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Jade Koskela @ 2014-10-13 21:02 UTC (permalink / raw)
  To: pgsql-odbc

I have been looking into this crash for a while now, and I finally have a
good repro.

After digging through it with wireshark I observed this
client tries to send a query
 retransmit query
 retransmit query
 ...
client sends TCP [RST],[ACK]
Now it has crashed, so we restart it again and begin another connection
successfully.

It seems that the connection has dropped, but the client was never
informed, and it doesn't handle this gracefully.

I reproed it like this:

On my mac running postgres server:
  Setup port forwarding to emulate a proxy or firewall problem
  ssh -L [public ip]:5433:localhost:5432 -N localhost

On my windows machine:
  Connect to port 5433 on my mac
  Run a query

On my mac:
  Kill the ssh proxy
  sighub postgres
  open the ssh proxy again

On my windows machine:
  Run another query (was never informed that the connection dropped)
  Crash in

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Fwd: crash bug on closed connection
@ 2014-10-13 23:44  Jade Koskela <jkoskela0@gmail.com>
  parent: Jade Koskela <jkoskela0@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Jade Koskela @ 2014-10-13 23:44 UTC (permalink / raw)
  To: pgsql-odbc

I have been looking into this crash for a while now, and I finally have a
good repro.

After digging through it with wireshark I observed this
client tries to send a query
 retransmit query
 retransmit query
 ...
client sends TCP [RST],[ACK]
Now it has crashed, so we restart it again and begin another connection
successfully.

It seems that the connection has dropped, but the client was never
informed, and it doesn't handle this gracefully.

I reproed it like this:

On my mac running postgres server:
  Setup port forwarding to emulate a proxy or firewall problem
  ssh -L [public ip]:5433:localhost:5432 -N localhost

On my windows machine:
  Connect to port 5433 on my mac
  Run a query

On my mac:
  Kill the ssh proxy
  sighup postgres
  open the ssh proxy again

On my windows machine:
  Run another query (machine still thinks connection is ok)
  Crash in psqlodbcw.dll

> psqlodbc35w.dll!Exec_with_parameters_resolved(StatementClass_ *
stmt=0x0a6f4fa0, int * exec_end=0x083bf3dc)  Line 606 + 0x1b bytes C
  psqlodbc35w.dll!PGAPI_Execute(void * hstmt=0x0a6f4fa0, unsigned short
flag=1)  Line 1147 + 0xd bytes C
  psqlodbc35w.dll!SQLExecute(void * StatementHandle=0x0a6f4fa0)  Line 386 +
0xe bytes C
  odbc32.dll!_SQLExecute@4()  + 0x2c1 bytes

> if (sscanf(cmd , "UPDATE %d", &count) == 1) // here cmd is junk but not
null (0xddddddd)

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: crash bug on closed connection
@ 2014-10-14 05:26  Jade Koskela <jkoskela0@gmail.com>
  parent: Jade Koskela <jkoskela0@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Jade Koskela @ 2014-10-14 05:26 UTC (permalink / raw)
  To: pgsql-odbc

Some of these steps might not be necessary. It might could be accomplished
with a kill -9 on postgres. I tried running Postgres on Windows, and force
killing it, but then the client always knew the connection was down.

When this occurs "in the wild", it is usually related to a timeout, so the
fix that was checked in recently for setting tcpKeepAlive might be a
workaround.

On Mon, Oct 13, 2014 at 4:44 PM, Jade Koskela <jkoskela0@gmail.com> wrote:

> I have been looking into this crash for a while now, and I finally have a
> good repro.
>
> After digging through it with wireshark I observed this
> client tries to send a query
>  retransmit query
>  retransmit query
>  ...
> client sends TCP [RST],[ACK]
> Now it has crashed, so we restart it again and begin another connection
> successfully.
>
> It seems that the connection has dropped, but the client was never
> informed, and it doesn't handle this gracefully.
>
> I reproed it like this:
>
> On my mac running postgres server:
>   Setup port forwarding to emulate a proxy or firewall problem
>   ssh -L [public ip]:5433:localhost:5432 -N localhost
>
> On my windows machine:
>   Connect to port 5433 on my mac
>   Run a query
>
> On my mac:
>   Kill the ssh proxy
>   sighup postgres
>   open the ssh proxy again
>
> On my windows machine:
>   Run another query (machine still thinks connection is ok)
>   Crash in psqlodbcw.dll
>
> > psqlodbc35w.dll!Exec_with_parameters_resolved(StatementClass_ *
> stmt=0x0a6f4fa0, int * exec_end=0x083bf3dc)  Line 606 + 0x1b bytes C
>   psqlodbc35w.dll!PGAPI_Execute(void * hstmt=0x0a6f4fa0, unsigned short
> flag=1)  Line 1147 + 0xd bytes C
>   psqlodbc35w.dll!SQLExecute(void * StatementHandle=0x0a6f4fa0)  Line 386
> + 0xe bytes C
>   odbc32.dll!_SQLExecute@4()  + 0x2c1 bytes
>
> > if (sscanf(cmd , "UPDATE %d", &count) == 1) // here cmd is junk but not
> null (0xddddddd)
>
>
>
>

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: crash bug on closed connection
@ 2014-10-14 05:27  Jade Koskela <jkoskela0@gmail.com>
  parent: Jade Koskela <jkoskela0@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Jade Koskela @ 2014-10-14 05:27 UTC (permalink / raw)
  To: pgsql-odbc

Also the mac/pc isn't relevant information in the repro that I posted. It
might as well just be client/server.

On Mon, Oct 13, 2014 at 10:26 PM, Jade Koskela <jkoskela0@gmail.com> wrote:

> Some of these steps might not be necessary. It might could be accomplished
> with a kill -9 on postgres. I tried running Postgres on Windows, and force
> killing it, but then the client always knew the connection was down.
>
> When this occurs "in the wild", it is usually related to a timeout, so the
> fix that was checked in recently for setting tcpKeepAlive might be a
> workaround.
>
> On Mon, Oct 13, 2014 at 4:44 PM, Jade Koskela <jkoskela0@gmail.com> wrote:
>
>> I have been looking into this crash for a while now, and I finally have a
>> good repro.
>>
>> After digging through it with wireshark I observed this
>> client tries to send a query
>>  retransmit query
>>  retransmit query
>>  ...
>> client sends TCP [RST],[ACK]
>> Now it has crashed, so we restart it again and begin another connection
>> successfully.
>>
>> It seems that the connection has dropped, but the client was never
>> informed, and it doesn't handle this gracefully.
>>
>> I reproed it like this:
>>
>> On my mac running postgres server:
>>   Setup port forwarding to emulate a proxy or firewall problem
>>   ssh -L [public ip]:5433:localhost:5432 -N localhost
>>
>> On my windows machine:
>>   Connect to port 5433 on my mac
>>   Run a query
>>
>> On my mac:
>>   Kill the ssh proxy
>>   sighup postgres
>>   open the ssh proxy again
>>
>> On my windows machine:
>>   Run another query (machine still thinks connection is ok)
>>   Crash in psqlodbcw.dll
>>
>> > psqlodbc35w.dll!Exec_with_parameters_resolved(StatementClass_ *
>> stmt=0x0a6f4fa0, int * exec_end=0x083bf3dc)  Line 606 + 0x1b bytes C
>>   psqlodbc35w.dll!PGAPI_Execute(void * hstmt=0x0a6f4fa0, unsigned short
>> flag=1)  Line 1147 + 0xd bytes C
>>   psqlodbc35w.dll!SQLExecute(void * StatementHandle=0x0a6f4fa0)  Line
>> 386 + 0xe bytes C
>>   odbc32.dll!_SQLExecute@4()  + 0x2c1 bytes
>>
>> > if (sscanf(cmd , "UPDATE %d", &count) == 1) // here cmd is junk but
>> not null (0xddddddd)
>>
>>
>>
>>
>

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: crash bug on closed connection
@ 2014-10-15 05:38  Jade Koskela <jkoskela0@gmail.com>
  parent: Jade Koskela <jkoskela0@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Jade Koskela @ 2014-10-15 05:38 UTC (permalink / raw)
  To: pgsql-odbc

Here is the end of the log.
I've done some debugging, when CC_send_query_append is called here, it
correctly identifies that there was an error, and exits the function.

res = CC_send_query_append(conn, self->stmt_with_params, qryi, qflag,
SC_get_ancestor(self), appendq); (statement.c:2069)

The result which is returned is not handled correctly (statement.c:2078)

if (appendq)
{
    QResultClass    *qres, *nres;

    if ( res->rstatus == PORES_EMPTY_QUERY && !res->next)
        res = NULL;

    for (qres = res; qres;)
    {
        if (qres->command && strnicmp(qres->command, fetch_cmd, 5) == 0)
        {
            res = qres;
            break;
        }
        nres = qres->next;
        if (nres && QR_get_notice(qres) != NULL)
        {
            if (QR_command_successful(nres) &&
                QR_command_nonfatal(qres))
            {
                QR_set_rstatus(nres, PORES_NONFATAL_ERROR);
            }
            QR_add_notice(nres, QR_get_notice(qres));
        }
        qres->next = NULL;
        QR_Destructor(qres);
        qres = nres;
    }
}

There is only a single result, with result.next == NULL.
This part of the code calls the destructor on the only result, but res is
still left pointing at it. After that fun things happen.
It gets a long way before it actually crashes in Exec_with_
parameters_resolved.



On Mon, Oct 13, 2014 at 10:27 PM, Jade Koskela <jkoskela0@gmail.com> wrote:

> Also the mac/pc isn't relevant information in the repro that I posted. It
> might as well just be client/server.
>
> On Mon, Oct 13, 2014 at 10:26 PM, Jade Koskela <jkoskela0@gmail.com>
> wrote:
>
>> Some of these steps might not be necessary. It might could be
>> accomplished with a kill -9 on postgres. I tried running Postgres on
>> Windows, and force killing it, but then the client always knew the
>> connection was down.
>>
>> When this occurs "in the wild", it is usually related to a timeout, so
>> the fix that was checked in recently for setting tcpKeepAlive might be a
>> workaround.
>>
>> On Mon, Oct 13, 2014 at 4:44 PM, Jade Koskela <jkoskela0@gmail.com>
>> wrote:
>>
>>> I have been looking into this crash for a while now, and I finally have
>>> a good repro.
>>>
>>> After digging through it with wireshark I observed this
>>> client tries to send a query
>>>  retransmit query
>>>  retransmit query
>>>  ...
>>> client sends TCP [RST],[ACK]
>>> Now it has crashed, so we restart it again and begin another connection
>>> successfully.
>>>
>>> It seems that the connection has dropped, but the client was never
>>> informed, and it doesn't handle this gracefully.
>>>
>>> I reproed it like this:
>>>
>>> On my mac running postgres server:
>>>   Setup port forwarding to emulate a proxy or firewall problem
>>>   ssh -L [public ip]:5433:localhost:5432 -N localhost
>>>
>>> On my windows machine:
>>>   Connect to port 5433 on my mac
>>>   Run a query
>>>
>>> On my mac:
>>>   Kill the ssh proxy
>>>   sighup postgres
>>>   open the ssh proxy again
>>>
>>> On my windows machine:
>>>   Run another query (machine still thinks connection is ok)
>>>   Crash in psqlodbcw.dll
>>>
>>> > psqlodbc35w.dll!Exec_with_parameters_resolved(StatementClass_ *
>>> stmt=0x0a6f4fa0, int * exec_end=0x083bf3dc)  Line 606 + 0x1b bytes C
>>>   psqlodbc35w.dll!PGAPI_Execute(void * hstmt=0x0a6f4fa0, unsigned short
>>> flag=1)  Line 1147 + 0xd bytes C
>>>   psqlodbc35w.dll!SQLExecute(void * StatementHandle=0x0a6f4fa0)  Line
>>> 386 + 0xe bytes C
>>>   odbc32.dll!_SQLExecute@4()  + 0x2c1 bytes
>>>
>>> > if (sscanf(cmd , "UPDATE %d", &count) == 1) // here cmd is junk but
>>> not null (0xddddddd)
>>>
>>>
>>>
>>>
>>
>

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

Attachments:

mylog_tail.txt (text/plain, 2.9K) download [15472-45.466]SendParseRequest: plan_name=_PLAN05B0F5E8 query=SELECT "test"."x" AS "none_x_ok", SUM("test"."y") AS "sum_y_ok" FROM "public"."test" "test" GROUP BY 1 [15472-45.468]sta_pidx=0 end_pidx=-1 num_p=0 [15472-45.468]SendDescribeRequest:plan_name=_PLAN05B0F5E8 [15472-45.468] stmt_with_params = '(null)' [15472-45.468]about to begin SC_execute [15472-45.468]SendBindRequest: plan_name=_PLAN05B0F5E8 [15472-45.469]SendExecuteRequest: plan_name=_PLAN05B0F5E8 count=0 [15472-45.469]in QR_Constructor [15472-45.470]exit QR_Constructor [15472-45.470]read 0, global_socket_buffersize=4096 [15472-45.470]read -1, global_socket_buffersize=4096 [15472-45.470]Lasterror=10053 [15472-45.470](5)Error while reading from the socket. ERRNO=10053 [15472-45.471]STATEMENT ERROR: func=SendSyncAndReceive, desc='', errnum=34, errmsg='No response from the backend' [15472-45.477]CONN ERROR: func=SendSyncAndReceive, desc='', errnum=110, errmsg='(NULL)' [15472-45.480]SendSyncAndReceive: 'id' - No response from the backend [15472-45.480]CC_on_abort in [15472-45.480]SOCK_Destructor [15472-45.480]QResult: enter DESTRUCTOR [15472-45.481]QResult: in QR_close_result [15472-45.481]QResult: free memory in, fcount=0 [15472-45.481]QResult: free memory out [15472-45.481]QResult: exit close_result [15472-45.482]QResult: exit DESTRUCTOR [15472-45.482]CC_on_abort in [15472-45.482]retval=-1 [15472-45.482][[SQLGetDiagFieldW]] Handle=(3,05B0F5E8) Rec=1 Id=4 info=(0859FAE0,12) [15472-45.482]PGAPI_GetDiagField entering rec=1 [15472-45.483]ER_ReturnError: status = 34, msg = #No response from the backend# [15472-45.483] szSqlState = '08S01',len=28, szError='(null)' [15472-45.483]PGAPI_GetDiagField exiting 0 [15472-45.484][[SQLGetDiagFieldW]] Handle=(3,05B0F5E8) Rec=2 Id=4 info=(0859FAE0,12) [15472-45.484]PGAPI_GetDiagField entering rec=2 [15472-45.484]ER_ReturnError: status = 34, msg = #No response from the backend# [15472-45.485]PGAPI_GetDiagField exiting 100 [15472-45.485][SQLGetDiagRecW] [15472-45.485]PGAPI_GetDiagRec entering type=3 rec=1 [15472-45.485]ER_ReturnError: status = 34, msg = #No response from the backend# [15472-45.486] szSqlState = '08S01',len=28, szError='No response from the backend' [15472-45.486]PGAPI_GetDiagRec exiting 0 [15472-45.486][SQLGetDiagRecW] [15472-45.486]PGAPI_GetDiagRec entering type=3 rec=2 [15472-45.487]ER_ReturnError: status = 34, msg = #No response from the backend# [15472-45.487]PGAPI_GetDiagRec exiting 100 [12428-45.488][[SQLFreeHandle]] [12428-45.488]PGAPI_FreeStmt: entering...hstmt=05B0F5E8, fOption=1 [12428-45.488]QResult: enter DESTRUCTOR [12428-45.488]SC_init_Result(5b0f5e8)[12428-45.488] SC_Destructor: self=05B0F5E8, self->result=00000000, self->hdbc=05B01A90 [12428-45.489]APD_free_params: ENTER, self=05B0F6F0 [12428-45.489]IPD_free_params: ENTER, self=05B0F730 [12428-45.489]PDATA_free_params: ENTER, self=05B0F7A8 [12428-45.490]SC_Destructor: EXIT
^ permalink raw reply [nested|flat] 9+ messages in thread

* Re: crash bug on closed connection
@ 2014-10-15 19:23  Inoue, Hiroshi <inoue@tpf.co.jp>
  parent: Jade Koskela <jkoskela0@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Inoue, Hiroshi @ 2014-10-15 19:23 UTC (permalink / raw)
  To: Jade Koskela <jkoskela0@gmail.com>; +Cc: pgsql-odbc

Hi Jade,

Could you please try the attached patch?

regards,
Hiroshi Inoue

On 2014/10/15 14:38, Jade Koskela wrote:
> Here is the end of the log.
> I've done some debugging, when CC_send_query_append is called here, it
> correctly identifies that there was an error, and exits the function.
>
> res = CC_send_query_append(conn, self->stmt_with_params, qryi, qflag,
> SC_get_ancestor(self), appendq); (statement.c:2069)
>
> The result which is returned is not handled correctly (statement.c:2078)
>
> if (appendq)
> {
>      QResultClass    *qres, *nres;
>
>      if ( res->rstatus == PORES_EMPTY_QUERY && !res->next)
>          res = NULL;
>
>      for (qres = res; qres;)
>      {
>          if (qres->command && strnicmp(qres->command, fetch_cmd, 5) == 0)
>          {
>              res = qres;
>              break;
>          }
>          nres = qres->next;
>          if (nres && QR_get_notice(qres) != NULL)
>          {
>              if (QR_command_successful(nres) &&
>                  QR_command_nonfatal(qres))
>              {
>                  QR_set_rstatus(nres, PORES_NONFATAL_ERROR);
>              }
>              QR_add_notice(nres, QR_get_notice(qres));
>          }
>          qres->next = NULL;
>          QR_Destructor(qres);
>          qres = nres;
>      }
> }
>
> There is only a single result, with result.next == NULL.
> This part of the code calls the destructor on the only result, but res
> is still left pointing at it. After that fun things happen.
> It gets a long way before it actually crashes in
> Exec_with_parameters_resolved.

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

Attachments:

fix_a_crash.patch (text/x-diff, 3.5K) download diff --git a/connection.c b/connection.c index af985f2..7f73296 100644 --- a/connection.c +++ b/connection.c @@ -2808,6 +2808,7 @@ CC_send_query_append(ConnectionClass *self, const char *query, QueryInfo *qi, UD int maxlen, empty_reqs; BOOL ReadyToReturn = FALSE, + retDetermined = FALSE, query_completed = FALSE, beforeV2 = !(PROTOCOL_64(&self->connInfo) || PROTOCOL_74(&self->connInfo)), aborted = FALSE, @@ -3246,6 +3247,7 @@ inolog("Discarded the first SAVEPOINT\n"); else retres = cmdres; aborted = TRUE; + retDetermined = TRUE; } query_completed = TRUE; } @@ -3389,17 +3391,28 @@ mylog("!!! copydata len=%d\n", response_length);  cleanup: if (SOCK_get_errcode(self->sock) != 0) - { - if (0 == CC_get_errornumber(self)) - CC_set_error(self, CONNECTION_COMMUNICATION_ERROR, "Communication error while sending query", func); kill_conn = TRUE; - } if (kill_conn) - { CC_on_abort(self, CONN_DEAD); + + if (CONN_DOWN == self->status) + { + if (0 == CC_get_errornumber(self)) + CC_set_error(self, CONNECTION_COMMUNICATION_ERROR, "Communication error while sending query", func); retres = NULL; + aborted = TRUE; } - if (rollback_on_error && CC_is_in_trans(self) && !discard_next_savepoint) + /* +  * Break before being ready to return. +  */ + else if (!ReadyToReturn && +  !retDetermined) + retres = cmdres; + /* Issue rollback command if necessary */ + if (CONN_CONNECTED == self->status && +  rollback_on_error && +  CC_is_in_trans(self) && +  !discard_next_savepoint) { char cmd[64];  @@ -3421,12 +3434,6 @@ cleanup: CLEANUP_FUNC_CONN_CS(func_cs_count, self); #undef return /* - * Break before being ready to return. - */ - if (!ReadyToReturn) - retres = cmdres; - - /* * Cleanup garbage results before returning. */ if (cmdres && retres != cmdres && !used_passed_result_object) diff --git a/statement.c b/statement.c index da5abf5..98faadf 100644 --- a/statement.c +++ b/statement.c @@ -2077,12 +2077,17 @@ inolog("get_Result=%p %p %d\n", res, SC_get_Result(self), self->curr_param_resul */ if (appendq) { - QResultClass *qres, *nres; + QResultClass *qres, *pres, *nres;  - for (qres = res; qres;) + for (qres = res, pres = NULL; qres;) { if (qres->command && strnicmp(qres->command, fetch_cmd, 5) == 0) { + if (NULL != pres) + { + pres->next = NULL; + QR_Destructor(res); + } res = qres; break; } @@ -2096,8 +2101,7 @@ inolog("get_Result=%p %p %d\n", res, SC_get_Result(self), self->curr_param_resul } QR_add_notice(nres, QR_get_notice(qres)); } - qres->next = NULL; - QR_Destructor(qres); + pres = qres; qres = nres; } }
^ permalink raw reply [nested|flat] 9+ messages in thread

* Re: crash bug on closed connection
@ 2014-10-15 23:59  Inoue, Hiroshi <inoue@tpf.co.jp>
  parent: Inoue, Hiroshi <inoue@tpf.co.jp>
  0 siblings, 1 reply; 9+ messages in thread

From: Inoue, Hiroshi @ 2014-10-15 23:59 UTC (permalink / raw)
  To: Jade Koskela <jkoskela0@gmail.com>; +Cc: pgsql-odbc

(2014/10/16 4:23), Inoue, Hiroshi wrote:
> Hi Jade,
>
> Could you please try the attached patch?

Oops the patch seems to contain *color* attributes.
Pleaae try the attached patch for this mail instead.

regards,
Hiroshi Inoue



-- 
I am using the free version of SPAMfighter.
SPAMfighter has removed 12760 of my spam emails to date.
Get the free SPAMfighter here: http://www.spamfighter.com/len

Do you have a slow PC? Try a Free scan 
http://www.spamfighter.com/SLOW-PCfighter?cid=sigen

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

Attachments:

fix_a_crash.patch (text/x-patch, 2.7K) download diff --git a/connection.c b/connection.c index af985f2..7f73296 100644 --- a/connection.c +++ b/connection.c @@ -2808,6 +2808,7 @@ CC_send_query_append(ConnectionClass *self, const char *query, QueryInfo *qi, UD int maxlen, empty_reqs; BOOL ReadyToReturn = FALSE, + retDetermined = FALSE, query_completed = FALSE, beforeV2 = !(PROTOCOL_64(&self->connInfo) || PROTOCOL_74(&self->connInfo)), aborted = FALSE, @@ -3246,6 +3247,7 @@ inolog("Discarded the first SAVEPOINT\n"); else retres = cmdres; aborted = TRUE; + retDetermined = TRUE; } query_completed = TRUE; } @@ -3389,17 +3391,28 @@ mylog("!!! copydata len=%d\n", response_length); cleanup: if (SOCK_get_errcode(self->sock) != 0) - { - if (0 == CC_get_errornumber(self)) - CC_set_error(self, CONNECTION_COMMUNICATION_ERROR, "Communication error while sending query", func); kill_conn = TRUE; - } if (kill_conn) - { CC_on_abort(self, CONN_DEAD); + + if (CONN_DOWN == self->status) + { + if (0 == CC_get_errornumber(self)) + CC_set_error(self, CONNECTION_COMMUNICATION_ERROR, "Communication error while sending query", func); retres = NULL; + aborted = TRUE; } - if (rollback_on_error && CC_is_in_trans(self) && !discard_next_savepoint) + /* + * Break before being ready to return. + */ + else if (!ReadyToReturn && + !retDetermined) + retres = cmdres; + /* Issue rollback command if necessary */ + if (CONN_CONNECTED == self->status && + rollback_on_error && + CC_is_in_trans(self) && + !discard_next_savepoint) { char cmd[64]; @@ -3421,12 +3434,6 @@ cleanup: CLEANUP_FUNC_CONN_CS(func_cs_count, self); #undef return /* - * Break before being ready to return. - */ - if (!ReadyToReturn) - retres = cmdres; - - /* * Cleanup garbage results before returning. */ if (cmdres && retres != cmdres && !used_passed_result_object) diff --git a/statement.c b/statement.c index da5abf5..98faadf 100644 --- a/statement.c +++ b/statement.c @@ -2077,12 +2077,17 @@ inolog("get_Result=%p %p %d\n", res, SC_get_Result(self), self->curr_param_resul */ if (appendq) { - QResultClass *qres, *nres; + QResultClass *qres, *pres, *nres; - for (qres = res; qres;) + for (qres = res, pres = NULL; qres;) { if (qres->command && strnicmp(qres->command, fetch_cmd, 5) == 0) { + if (NULL != pres) + { + pres->next = NULL; + QR_Destructor(res); + } res = qres; break; } @@ -2096,8 +2101,7 @@ inolog("get_Result=%p %p %d\n", res, SC_get_Result(self), self->curr_param_resul } QR_add_notice(nres, QR_get_notice(qres)); } - qres->next = NULL; - QR_Destructor(qres); + pres = qres; qres = nres; } }
^ permalink raw reply [nested|flat] 9+ messages in thread

* Re: crash bug on closed connection
@ 2014-10-16 17:28  Jade Koskela <jkoskela0@gmail.com>
  parent: Inoue, Hiroshi <inoue@tpf.co.jp>
  0 siblings, 1 reply; 9+ messages in thread

From: Jade Koskela @ 2014-10-16 17:28 UTC (permalink / raw)
  To: Inoue, Hiroshi <inoue@tpf.co.jp>; pgsql-odbc

Yeah that fixes it. Thanks! I tried to fix it myself, but it was just a
hack.
Did this make the cutoff for the next release?

Jade Koskela

On Wed, Oct 15, 2014 at 4:59 PM, Inoue, Hiroshi <inoue@tpf.co.jp> wrote:

> (2014/10/16 4:23), Inoue, Hiroshi wrote:
>
>> Hi Jade,
>>
>> Could you please try the attached patch?
>>
>
> Oops the patch seems to contain *color* attributes.
> Pleaae try the attached patch for this mail instead.
>
> regards,
> Hiroshi Inoue
>
>
>
> --
> I am using the free version of SPAMfighter.
> SPAMfighter has removed 12760 of my spam emails to date.
> Get the free SPAMfighter here: http://www.spamfighter.com/len
>
> Do you have a slow PC? Try a Free scan http://www.spamfighter.com/
> SLOW-PCfighter?cid=sigen
>

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: crash bug on closed connection
@ 2015-04-13 03:46  Jade Koskela <jkoskela0@gmail.com>
  parent: Jade Koskela <jkoskela0@gmail.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Jade Koskela @ 2015-04-13 03:46 UTC (permalink / raw)
  To: Inoue, Hiroshi <inoue@tpf.co.jp>; pgsql-odbc

Sorry to revive this, but I don't think this patch ever made it into the
repository.

On Thu, Oct 16, 2014 at 10:28 AM, Jade Koskela <jkoskela0@gmail.com> wrote:

> Yeah that fixes it. Thanks! I tried to fix it myself, but it was just a
> hack.
> Did this make the cutoff for the next release?
>
> Jade Koskela
>
> On Wed, Oct 15, 2014 at 4:59 PM, Inoue, Hiroshi <inoue@tpf.co.jp> wrote:
>
>> (2014/10/16 4:23), Inoue, Hiroshi wrote:
>>
>>> Hi Jade,
>>>
>>> Could you please try the attached patch?
>>>
>>
>> Oops the patch seems to contain *color* attributes.
>> Pleaae try the attached patch for this mail instead.
>>
>> regards,
>> Hiroshi Inoue
>>
>>
>>
>> --
>> I am using the free version of SPAMfighter.
>> SPAMfighter has removed 12760 of my spam emails to date.
>> Get the free SPAMfighter here: http://www.spamfighter.com/len
>>
>> Do you have a slow PC? Try a Free scan http://www.spamfighter.com/
>> SLOW-PCfighter?cid=sigen
>>
>
>

^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2015-04-13 03:46 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-10-13 21:02 crash bug on closed connection Jade Koskela <jkoskela0@gmail.com>
2014-10-13 23:44 ` Jade Koskela <jkoskela0@gmail.com>
2014-10-14 05:26   ` Jade Koskela <jkoskela0@gmail.com>
2014-10-14 05:27     ` Jade Koskela <jkoskela0@gmail.com>
2014-10-15 05:38       ` Jade Koskela <jkoskela0@gmail.com>
2014-10-15 19:23         ` Inoue, Hiroshi <inoue@tpf.co.jp>
2014-10-15 23:59           ` Inoue, Hiroshi <inoue@tpf.co.jp>
2014-10-16 17:28             ` Jade Koskela <jkoskela0@gmail.com>
2015-04-13 03:46               ` Jade Koskela <jkoskela0@gmail.com>

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