Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XeYTQ-0001KD-Fk for pgsql-odbc@arkaria.postgresql.org; Wed, 15 Oct 2014 23:59:20 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XeYTP-00063L-4y for pgsql-odbc@arkaria.postgresql.org; Wed, 15 Oct 2014 23:59:19 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XeYTO-00063E-F0 for pgsql-odbc@postgresql.org; Wed, 15 Oct 2014 23:59:18 +0000 Received: from sd.tpf.co.jp ([210.161.239.34]) by makus.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XeYTK-0003Co-Ng for pgsql-odbc@postgresql.org; Wed, 15 Oct 2014 23:59:16 +0000 Received: (qmail 24037 invoked by uid 502); 15 Oct 2014 23:59:12 -0000 Received: from unknown (HELO ?127.0.0.1?) (100.126.1.62) by sd2.tpf-fw-c.co.jp with SMTP; 15 Oct 2014 23:59:12 -0000 Message-ID: <543F0A50.4040106@tpf.co.jp> Date: Thu, 16 Oct 2014 08:59:12 +0900 From: "Inoue, Hiroshi" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Jade Koskela CC: "pgsql-odbc@postgresql.org" Subject: Re: crash bug on closed connection References: <543EC9BA.1020901@tpf.co.jp> In-Reply-To: <543EC9BA.1020901@tpf.co.jp> Content-Type: multipart/mixed; boundary="------------030200030704070400010901" X-Pg-Spam-Score: -1.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 This is a multi-part message in MIME format. --------------030200030704070400010901 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit (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 --------------030200030704070400010901 Content-Type: text/x-patch; name="fix_a_crash.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fix_a_crash.patch" 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; } } --------------030200030704070400010901 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc --------------030200030704070400010901--