Re: crash bug on closed connection

From: Jade Koskela <jkoskela0(at)gmail(dot)com>
To: "pgsql-odbc(at)postgresql(dot)org" <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: crash bug on closed connection
Date: 2014-10-14 05:27:21
Message-ID: CAN5ZvqyRro-wHxZoam=MoZh9Aa+0uwJ84bsOXKXb0jz8CyJqaA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)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(at)gmail(dot)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(dot)dll!_SQLExecute(at)4() + 0x2c1 bytes
>>
>> > if (sscanf(cmd , "UPDATE %d", &count) == 1) // here cmd is junk but
>> not null (0xddddddd)
>>
>>
>>
>>
>

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Inoue, Hiroshi 2014-10-14 06:46:08 Re: [BUGS] BUG #11608: ODBC driver crashes after wrong password entered
Previous Message Jade Koskela 2014-10-14 05:26:09 Re: crash bug on closed connection