Coredump under Purify
441554Apr 27 2005 — edited Aug 2 2005I wrote a C++ application that uses the OCI to run queries and print the fetched data. It works fine, but when I try to run it under Purify, I get a ZPR followed by a core dump on the call to OCIDescriptorAlloc().
Because I couldn't be sure whether the problem was something in my program, I simplified the code down to the line that seems to be triggering the core dump, plus an OCIEnvCreate (since OCIDecriptorAlloc() needs an environment handle) along with a few informational printf()s, and it still dumps core.
I'm running on Solaris 2.8 using PurifyPlus-2003a.06.00 with gcc/g++ 3.3.1 and Oracle 10g client (32-bit libs). In this program, I need a timestamp descriptor, but I tried the same code with other types of descriptors. Snapshop, LOB, and RowID descriptors run fine under Purify, but Date, Timestamp, Interval, and ComplexObjectComp ones all coredump.
Without Purify, everything is fine; no crashes or other problems. But as I need to incorporate this into a multithreaded application, being able to use Purify is essential.
The simplified program is short, so I'll paste it here:
#include <stdio.h>
#include <oci.h>
#include <orl.h>
main()
{
sword rc;
OCIEnv *env = NULL;
OCIDateTime *dtval = NULL;
rc = OCIEnvCreate(&env, OCI_OBJECT, (void *) 0, 0, 0, 0, (size_t) 0, (void **) 0);
if (rc != OCI_SUCCESS && rc != OCI_SUCCESS_WITH_INFO)
fprintf(stderr, "Error creating environment\n");
else printf("Env created: %ld\n", env);
rc = OCIDescriptorAlloc((void *) env, (void **) &dtval, OCI_DTYPE_TIMESTAMP, 0, NULL);
if (rc != OCI_SUCCESS && rc != OCI_SUCCESS_WITH_INFO)
fprintf(stderr, "Error allocating descriptor\n");
else printf("Descriptor allocated\n");
rc = OCIDescriptorFree((void *) dtval, OCI_DTYPE_TIMESTAMP); // This is where it coredumps.
if (rc != OCI_SUCCESS && rc != OCI_SUCCESS_WITH_INFO)
fprintf(stderr, "Error freeing descriptor\n");
else printf("Descriptor freed\n");
}
Compile lines:
purify g++ -g -Wall -I/export/home/oracle/product/10.1.0/db_1/rdbms/public -I/export/home/oracle/product/10.1.0/db_1/plsql/public -I/cm/tools/paks/PurifyPlus-2003a.06.00/releases/purify.sol.2003a.06.00 -I../../include -c otest.cpp
otest.cpp:6: warning: ISO C++ forbids declaration of `main' with no type
purify g++ -g -Wall -o otest otest.o -lclntsh -L/export/home/oracle/product/10.1.0/db_1/lib32 -L/export/home/oracle/product/10.1.0/db_1/rdbms/lib32 -L/cm/tools/paks/PurifyPlus-2003a.06.00/releases/purify.sol.2003a.06.00/lib32 -lm
Purify output:
**** Purify instrumented otest (pid 4992 at Tue Apr 26 14:50:17 2005)
* Purify 2003a.06.00 Solaris 2 (32-bit) Copyright (C) 1992-2003 Rational Software Corp. All rights reserved.
* For contact information type: "purify -help"
* For Purify Viewer output, set the DISPLAY environment variable.
* Options settings: -max_threads=200 \
-cache-dir=/export/home/tmancuso/harvester/src/.purify.cache -best-effort \
-g++=yes -purify \
-purify-home=/cm/tools/paks/PurifyPlus-2003a.06.00/releases/purify.sol.2003a.06.00 \
-gcc3_path=/cm/tools/apps/bin/../../paks/gcc-3.3.1/bin/g++ \
-cache-dir=/export/home/tmancuso/harvester/src/.purify.cache \
-demangle_program=/cm/tools/apps/bin/../../paks/gcc-3.3.1/bin/c++filt \
-threads=yes -use-internal-locks=yes -thread_stack_change=0x4000 \
-mt_safe_malloc=yes
* License successfully checked out.
* Command-line: otest
**** Purify instrumented otest (pid 4992) ****
UMR: Uninitialized memory read:
* This is occurring while in:
kouogini [kouo.c]
kouoini [kouo.c]
kpuinit0 [kpuini.c]
kpuenvcr [kpuini.c]
OCIEnvCreate [oci8.c]
main [otest.cpp:11]
* Reading 4 bytes from 0xffbee34c on the stack.
* Address 0xffbee34c is 308 bytes below frame pointer in function kouogini.
**** Purify instrumented otest (pid 4992) ****
UMR: Uninitialized memory read:
* This is occurring while in:
kpminit [kpm.c]
kpuinit0 [kpuini.c]
kpuenvcr [kpuini.c]
OCIEnvCreate [oci8.c]
main [otest.cpp:11]
_start [crt1.o]
* Reading 4 bytes from 0xffbee46c on the stack.
* Address 0xffbee46c is 132 bytes below frame pointer in function kpminit.
Env created: 1290920
**** Purify instrumented otest (pid 4992) ****
ZPR: Zero page read:
* This is occurring while in:
kpugdesc [kpuini.c]
main [otest.cpp:16]
_start [crt1.o]
* Reading 4 bytes from 0x26c4
**** Purify instrumented otest (pid 4992) ****
COR: Fatal core dump:
* This is occurring while in:
kpugdesc [kpuini.c]
main [otest.cpp:16]
_start [crt1.o]
* Received signal 11 (SIGSEGV - Segmentation Fault)
* Faulting address = 0x26c4
* Signal mask: (SIGSEGV)
* Pending signals:
Segmentation Fault(coredump)
Thanks,
--Tina