Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 54640B5DBC0 for ; Fri, 30 Sep 2011 09:37:06 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 40040-02 for ; Fri, 30 Sep 2011 12:36:59 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from winpg.jp (winpg.jp [182.48.52.43]) by mail.postgresql.org (Postfix) with ESMTP id B9E22B5DBC1 for ; Fri, 30 Sep 2011 09:36:58 -0300 (ADT) Received: from [192.168.202.3] (p2009-ipad401funabasi.chiba.ocn.ne.jp [123.217.236.9]) by winpg.jp (Postfix) with ESMTPA id B9D6224A9C8; Fri, 30 Sep 2011 21:36:58 +0900 (JST) Message-ID: <4E85B7ED.1010801@winpg.jp> Date: Fri, 30 Sep 2011 21:37:01 +0900 From: Hiroshi Saito User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ja; rv:1.9.2.22) Gecko/20110902 Thunderbird/3.1.14 MIME-Version: 1.0 To: Arvind N CC: "pgsql-odbc@postgresql.org" , Hiroshi Inoue Subject: Re: psqlodbc-09.00.0310 Crash issues with aggregate function based queries.. specifically SUM and AVG. References: <97F4356AEA71904482CD192135C038F9DF6CA171A3@BANPMAILBOX01.citrite.net> In-Reply-To: <97F4356AEA71904482CD192135C038F9DF6CA171A3@BANPMAILBOX01.citrite.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201109/13 X-Sequence-Number: 10710 Hi. Sorry very late reaction. Ummm, I have not used poco libraries.... abnormalities have occurred in your environment certainly. It seems that it is necessary to investigate it. Please send mylog to Inoue-san with me. I appreciate your perseverance. thanks. Regards, Hiroshi Saito (2011/09/22 16:10), Arvind N wrote: > Hi, > While using psqlodbcw.so inline with poco libraries SQL query support, noticed consistent crashes in the odbc library. The issue seems to be only with SUM and AVG aggregate handling . > > The query in question is the below one. Consistently I keep getting odbc crashes. Verified this same query works fine using java postgres drivers. Also verified that postgres databases is not having any problems and returns properly. The issue is only when Poco library parses the response and it calls the SQLDescribeCol (statement_handle=0xc44000, column_number=8 ..... ) to extract output from response. NOTE: max() function does not seem to have any issue. > > Find below the gdb trace back. The issue narrows down getAtttypmodEtc (stmt=0x0, col=4, adtsize_or_longestlen=0x7fffff5fa7c8) at pgtypes.c:1448 always in all the crashes. Tracing back pgtypes.c I see that some fix was done to QR_get_value_backend_text macro call, the 9.00.0200 version of ODBC seems to have (res,col,i) and in 9.00.0310 seems to have changed to for some fix I guess... but there still is some issue here. NOTE: the same below query sometimes works and the same sometimes causes crashes. Crashes being more often. The column number shows passed to SQLDescribeCol (StatementHandle=0xc4f400, ColumnNumber=8) says 8 and this corresponds to SUM(stnsoctet_delta_count). Any pointers would be most helpful. Is this a known issue... ??????? > > ********************************** pgtypes.c *********************************** > > 1443 for (i = 0; i< res->num_cached_rows; i++) > 1444 { > 1445 if (tval = QR_get_value_backend_text(res, i, col), NULL != tval) > 1446 { > 1447 if (sptr = strchr(tval, '.'), NULL != sptr) > 1448 if (sval = strlen(tval) - (sptr + 1 - tval), sval> max scale) > 1449 maxscale = sval; > 1450 } > 1451 } > > QUERY :: > select distinct ctnssource_ip_address, ctnsappname, http_req_url, count(http_req_url) as count_url, http_req_host, exporter_id, SUM(egresssvcoutoctet_delta_count),SUM(stnsoctet_delta_count), MAX(latestdatarecord_rx_time) from af_master_table GROUP BY ctnssource_ip_address, http_req_url, ctnsappname, http_req_host, exporter_id ORDER BY count_url DESC > > GDB trace ::: > > #152 0x00000008042b7df5 in __FUNCTION__.6 () from /var/mps/install/lib/psqlodbcw.so > #153 0x00000008042828ad in getAtttypmodEtc (stmt=0x0, col=4, adtsize_or_longestlen=0x7fffff5fa7c8) at pgtypes.c:1448 > #154 0x0000000804282a78 in pgtype_column_size (stmt=0xc4f400, type=1700, col=4, handle_unknown_size_as=0) at pgtypes.c:1794 > #155 0x0000000804286ad6 in PGAPI_DescribeCol (hstmt=0xc4f400, icol=7, szColName=0xc5c040 "", cbColNameMax=2048, > pcbColName=0xc5c840, pfSqlType=0xc5c842, pcbColDef=0xc5c848, pibScale=0xc5c850, pfNullable=0xc5c852) at results.c:360 > #156 0x000000080429fe49 in SQLDescribeCol (StatementHandle=0xc4f400, ColumnNumber=8, ColumnName=0xc5c040 "", BufferLength=2048, > NameLength=0xc5c840, DataType=0xc5c842, ColumnSize=0x17e, DecimalDigits=0x17e, Nullable=0x17e) at odbcapi.c:283 > #157 0x00000008025cd8e0 in SQLDescribeCol (statement_handle=0xc44000, column_number=8, column_name=0xc5c040 "", > buffer_length=2048, name_length=0xc5c840, data_type=0xc5c842, column_size=0xc5c848, decimal_digits=0xc5c850, nullable=0xc5c852) > at SQLDescribeCol.c:447 > #158 0x000000080222c5fa in Poco::Data::ODBC::ODBCColumn::getDescription () from lib//libPocoODBC.so.10 > #159 0x000000080222c685 in Poco::Data::ODBC::ODBCColumn::init () from lib//libPocoODBC.so.10 > #160 0x000000080222ca0c in Poco::Data::ODBC::ODBCColumn::ODBCColumn () from lib//libPocoODBC.so.10 > #161 0x00000008022321da in Poco::Data::ODBC::ODBCStatementImpl::fillColumns () from lib//libPocoODBC.so.10 > #162 0x0000000802232cba in Poco::Data::ODBC::ODBCStatementImpl::compileImpl () from lib//libPocoODBC.so.10 > #163 0x00000008020f3e08 in Poco::Data::StatementImpl::compile () from lib//libPocoData.so.10 > #164 0x00000008020f3f1f in Poco::Data::StatementImpl::executeWithLimit () from lib//libPocoData.so.10 > #165 0x00000008020f40d3 in Poco::Data::StatementImpl::execute () from lib//libPocoData.so.10 > > > Thanks > Arvind > >