Catalog apis not working in T2

Bug #1354274 reported by Aruna Sadashiva
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Trafodion
Fix Released
High
Daniel Lu

Bug Description

With the recent checkin, there seems to be memory corruption, catalog api tests with T2 crashes in different tests each time with stack similar to this in different glibc functions every time:

Accessing Metadata
getTypeInfo()
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGBUS (0x7) at pc=0x0000003ea146fa3b, pid=18842, tid=140197756495616
#
# JRE version: OpenJDK Runtime Environment (7.0_55-b13) (build 1.7.0_55-mockbuild_2014_04_09_11_51-b00)
# Java VM: OpenJDK 64-Bit Server VM (24.51-b03 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libc.so.6+0x6fa3b] vsnprintf+0x8b
#
# Core dump written. Default location: /home/trafodion/aruna/jdbc/tests/core or core.18842
#
# An error report file with more information is saved as:
# /tmp/jvm-18842/hs_error.log
#
# If you would like to submit a bug report, please include
# instructions on how to reproduce the bug and visit:
# http://icedtea.classpath.org/bugzilla
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted (core dumped)

(gdb) bt
#0 0x0000003ea1432925 in raise () from /lib64/libc.so.6
#1 0x0000003ea143408d in abort () from /lib64/libc.so.6
#2 0x00007f8255f4d8c5 in ?? () from /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.55.x86_64/jre/lib/amd64/server/libjvm.so
#3 0x00007f82560bb78f in ?? () from /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.55.x86_64/jre/lib/amd64/server/libjvm.so
#4 0x00007f8255f52a92 in JVM_handle_linux_signal () from /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.55.x86_64/jre/lib/amd64/server/libjvm.so
#5 <signal handler called>
#6 0x0000003ea146fa3b in vsnprintf () from /lib64/libc.so.6
#7 0x0000003ea144f523 in snprintf () from /lib64/libc.so.6
#8 0x00007f823ed50f69 in do_ExecSMD (objtag_=0x0, call_id_=0x0, executeException=0x7f8255795330, sqlWarning=0x7f82557955c0, dialogueId=37323232,
    tableTypeList=0x7f823ed56d7c "", metadataId=0, APIType=47, stmtLabel=0x7f823ed56246 "SQL_CATALOG_API", sqlStmtType=1, catalogNm=0x7f823ed56d7c "",
    schemaNm=0x7f823ed56d7c "", tableNm=0x7f823ed56d7c "", columnNm=0x7f823ed56d7c "", tableParam=0x7f82557950d0, inputParam=0x7f82557951f0,
    outputDesc=0x7f82557955d0, stmtId=0x7f8255795590) at native/SrvrCommon.cpp:1281
#9 0x00007f823ed51cf9 in executeAndFetchSMDQuery (objtag_=0x0, call_id_=0x0, dialogueId=37323232, APIType=47, stmtLabel=0x7f823ed56246 "SQL_CATALOG_API",
    sqlStmtType=1, tableParam=0x7f82557950d0, inputParam=0x7f82557951f0, catalogNm=0x7f823ed56d7c "", schemaNm=0x7f823ed56d7c "",
    tableNm=0x7f823ed56d7c "", columnNm=0x7f823ed56d7c "", tableTypeList=0x7f823ed56d7c "", metadataId=0, outputDesc=0x7f82557955d0,
    executeException=0x7f8255795330, fetchException=0x7f8255795310, sqlWarning=0x7f82557955c0, rowsAffected=0x7f82557955a8, outputValueList=0x7f82557955b0,
    stmtId=0x7f8255795590) at native/SrvrCommon.cpp:1660
#10 0x00007f823ed35594 in odbc_SQLSvc_GetSQLCatalogs_sme_ (objtag_=0x0, call_id_=0x0, exception_=0x7f8255795570, dialogueId=37323232, APIType=47,
    catalogNm=0x7f823ed56d7c "", schemaNm=0x7f823ed56d7c "", tableNm=0x7f823ed56d7c "", tableTypeList=0x7f823ed56d7c "", columnNm=0x7f823ed56d7c "",
    columnType=0, rowIdScope=0, nullable=0, uniqueness=0, accuracy=0, sqlType=0, metadataId=0, catStmtLabel=0x7f8255795530 "\220TyU\202\177",
    outputDesc=0x7f82557955d0, sqlWarning=0x7f82557955c0, rowsAffected=0x7f82557955a8, outputValueList=0x7f82557955b0, stmtId=0x7f8255795590,
    fkcatalogNm=0x7f823ed56d7c "", fkschemaNm=0x7f823ed56d7c "", fktableNm=0x7f823ed56d7c "") at native/SrvrSmd.cpp:312
#11 0x00007f823ed44e7b in getSQLCatalogsInfo (jenv=0x19581d8, jobj=0x7f8255795818, server=0x0, dialogueId=37323232, txid=0, autoCommit=1 '\001', txnMode=2,
    catalogAPI=47, catalogNm=0x0, schemaNm=0x0, tableNm=0x0, tableTypeList=0x0, columnNm=0x0, columnType=0, rowIdScope=0, nullable=0, uniqueness=0,
    accuracy=0, sqlType=0, metadataId=0, fkcatalogNm=0x0, fkschemaNm=0x0, fktableNm=0x0) at native/SQLMXCommonFunctions.cpp:2212
#12 0x00007f823ed4b4a0 in Java_org_trafodion_jdbc_t2_SQLMXDatabaseMetaData_getTypeInfo (jenv=0x19581d8, jobj=0x7f8255795818, server=0x0,
    dialogueId=37323232, txid=0, autoCommit=1 '\001', txnMode=2) at native/SQLMXDatabaseMetaData.cpp:157

Catalog apis are not working with T2 driver. Various errors are returned:

TestBasic8(TestBasic): Exception in test JDBC Get Catalogs..Invalid Statement/Connection handle
TestBasic10(TestBasic): Exception in test JDBC Get Columns..Module Error - PqÉö
TestBasic11(TestBasic): Exception in test JDBC Get Columns 2..*** ERROR[8884] Prohibited SQL statement attempted.
TestBasic13(TestBasic): Exception in test JDBC Get Columns 4..Programming Error -

Changed in trafodion:
milestone: none → r0.9
description: updated
Changed in trafodion:
importance: High → Critical
Changed in trafodion:
importance: Critical → High
Revision history for this message
Pavani Puppala (pavani-puppala) wrote :

There seem quite a few things that need to be fixed in catalog API. The initial problem with this stack seem to be that instead of allocating 20,000 bytes to hold sql string of type char *, 20000 of SQLValue_def structs are allocated and the memory for sql string is not actually allocated which would cause memory overwrite leading to different types of failures.

There seem to be other problems not limited to the following
 1) multiple statements being allocated with the same stmt name before closing/deallocating the statement
 2) memory leaks
 3) not setting the size of the sql string buffer
 4) not checking errors from CLI calls and continuing further execution.

description: updated
Changed in trafodion:
assignee: Rajeswari Muddu (rajeswari-j-muddu) → RuoYu Zuo (ruo-yu-zuo)
Changed in trafodion:
milestone: r0.9 → r1.0
Jian Jin (jian-jin)
Changed in trafodion:
assignee: RuoYu Zuo (ruo-yu-zuo) → Daniel Lu (ping-lu)
Daniel Lu (ping-lu)
Changed in trafodion:
importance: High → Medium
Changed in trafodion:
importance: Medium → High
assignee: Daniel Lu (ping-lu) → nobody
Daniel Lu (ping-lu)
Changed in trafodion:
assignee: nobody → Daniel Lu (ping-lu)
status: New → In Progress
Jian Jin (jian-jin)
Changed in trafodion:
milestone: r1.0 → r1.1
Daniel Lu (ping-lu)
Changed in trafodion:
status: In Progress → Fix Committed
Changed in trafodion:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.