psqlodbc-09.00.0310 Crash issues with aggregate function basedqueries.. specifically SUM and AVG.

psqlodbc-09.00.0310 Crash issues with aggregate function basedqueries.. specifically SUM and AVG.

am 22.09.2011 09:10:58 von Arvind N

Hi,
While using psqlodbcw.so inline with poco libraries SQL query support,=
noticed consistent crashes in the odbc library. The issue seems to be onl=
y with SUM and AVG aggregate handling .=20

The query in question is the below one. Consistently I keep getting odbc cr=
ashes. Verified this same query works fine using java postgres drivers. Als=
o verified that postgres databases is not having any problems and returns p=
roperly. The issue is only when Poco library parses the response and it cal=
ls the SQLDescribeCol (statement_handle=3D0xc44000, column_number=3D8 .....=
) to extract output from response. NOTE: max() function does not seem to =
have any issue.=20

Find below the gdb trace back. The issue narrows down getAtttypmodEtc (stmt=
=3D0x0, col=3D4, adtsize_or_longestlen=3D0x7fffff5fa7c8) at pgtypes.c:1448 =
always in all the crashes. Tracing back pgtypes.c I see that some fix was d=
one 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 so=
me 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 (StatementHan=
dle=3D0xc4f400, ColumnNumber=3D8) says 8 and this corresponds to SUM(stnsoc=
tet_delta_count). Any pointers would be most helpful. Is this a known issue=
.... ???????

********************************** pgtypes.c ******************************=
*****

1443 for (i =3D 0; i < res->num_cached_rows; i++)
1444 {
1445 if (tval =3D Q=
R_get_value_backend_text(res, i, col), NULL !=3D tval)
1446 {
1447 if (sp=
tr =3D strchr(tval, '.'), NULL !=3D sptr)
1448 =
if (sval =3D strlen(tval) - (sptr + 1 - tval), sval > max scale)
1449 =
maxscale =3D sval;
1450 }
1451 }

QUERY ::
select distinct ctnssource_ip_address, ctnsappname, http_req_url, count(htt=
p_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/psql=
odbcw.so
#153 0x00000008042828ad in getAtttypmodEtc (stmt=3D0x0, col=3D4, adtsize_or=
_longestlen=3D0x7fffff5fa7c8) at pgtypes.c:1448
#154 0x0000000804282a78 in pgtype_column_size (stmt=3D0xc4f400, type=3D1700=
, col=3D4, handle_unknown_size_as=3D0) at pgtypes.c:1794
#155 0x0000000804286ad6 in PGAPI_DescribeCol (hstmt=3D0xc4f400, icol=3D7, s=
zColName=3D0xc5c040 "", cbColNameMax=3D2048,=20
    pcbColName=3D0xc5c840, pfSqlType=3D0xc5c842, pcbColDef=3D0xc5c8=
48, pibScale=3D0xc5c850, pfNullable=3D0xc5c852) at results.c:360
#156 0x000000080429fe49 in SQLDescribeCol (StatementHandle=3D0xc4f400, Colu=
mnNumber=3D8, ColumnName=3D0xc5c040 "", BufferLength=3D2048,=20
    NameLength=3D0xc5c840, DataType=3D0xc5c842, ColumnSize=3D0x17e,=
DecimalDigits=3D0x17e, Nullable=3D0x17e) at odbcapi.c:283
#157 0x00000008025cd8e0 in SQLDescribeCol (statement_handle=3D0xc44000, col=
umn_number=3D8, column_name=3D0xc5c040 "",=20
    buffer_length=3D2048, name_length=3D0xc5c840, data_type=3D0xc5c=
842, column_size=3D0xc5c848, decimal_digits=3D0xc5c850, nullable=3D0xc5c852)
  =A0 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 () f=
rom lib//libPocoData.so.10
#165 0x00000008020f40d3 in Poco::Data::StatementImpl::execute () from lib//=
libPocoData.so.10


Thanks
Arvind


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

Re: psqlodbc-09.00.0310 Crash issues with aggregate functionbased queries.. specifically SUM and AV

am 30.09.2011 14:37:01 von Hiroshi Saito

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
>
>


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