Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WxZeS-00027A-MI for pgsql-odbc@arkaria.postgresql.org; Thu, 19 Jun 2014 10:33:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WxZeS-0006g7-20 for pgsql-odbc@arkaria.postgresql.org; Thu, 19 Jun 2014 10:33:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WxZeR-0006g0-FM for pgsql-odbc@postgresql.org; Thu, 19 Jun 2014 10:33:03 +0000 Received: from smtp-outbound-1.vmware.com ([208.91.2.12]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1WxZeH-0003LF-KD for pgsql-odbc@postgresql.org; Thu, 19 Jun 2014 10:33:01 +0000 Received: from sc9-mailhost2.vmware.com (sc9-mailhost2.vmware.com [10.113.161.72]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 6BC169A38A; Thu, 19 Jun 2014 03:32:48 -0700 (PDT) Received: from zcs-prod-ext-mta-1.vmware.com (zcs-prod-ext-mta-1.vmware.com [10.113.62.223]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 63F39B0C91; Thu, 19 Jun 2014 03:32:48 -0700 (PDT) Received: from zcs-prod-ext-mta-1.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTP id CE4A012002A; Thu, 19 Jun 2014 03:33:02 -0700 (PDT) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTPSA; Thu, 19 Jun 2014 03:33:01 -0700 (PDT) Message-ID: <53A2BC4D.2030503@vmware.com> Date: Thu, 19 Jun 2014 13:32:45 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: Craig Ringer , "pgsql-odbc@postgresql.org" Subject: Re: Protocol de-synchronisation bug, bogus query sent References: <53A25C95.707@2ndquadrant.com> In-Reply-To: <53A25C95.707@2ndquadrant.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -6.9 (------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org On 06/19/2014 06:44 AM, Craig Ringer wrote: > The whole code block around connection.c:3082 appears to be attempting > to send an empty query in order to elicit an 'I' (EmptyQueryResponse) > message. It sends a malformed protocol message: > > SOCK_put_string(self->sock, "Q "); > SOCK_flush_output(self->sock); > > so the server just waits for the rest of the message, never responding. > > When the connection is killed by program exit later, the server will log: > > LOG: unexpected EOF within message length word > LOG: disconnection: session time: 0:00:08.910 user=Administrator > database=XXXX host=127.0.0.1 port=53705 > LOG: could not receive data from client: No connection could be made > because the target machine actively refused it. > > > That's because the V3 protocol specifies that the message format for > Query is: > > 'Q' > [32 bit integer] > [query string] > > http://www.postgresql.org/docs/current/static/protocol-message-formats.html > > ... but psqlODBC just sends: > > 'Q' > '\x20' > '\x00' > > If it is really necessary to go through this empty-query dance, then for > the V3 protocol the correct message would be: > > /* Send an empty query to elicit an 'I' (EmptyQueryResponse) > * from the server */ > SOCK_put_char(self->sock, 'Q'); > SOCK_put_int(self->sock, 5, 4); > SOCK_put_char(self->sock, '\0'); Hmm. Just before that code, there's this: > if (!beforeV2) > break; So we shouldn't even get there with protocol version 3. But if you managed to hit that, apparently we do. Can you debug that further? - Heikki -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc