Home » Developer & Programmer » Precompilers, OCI & OCCI » Problems with OCCI on Linux RHEL5.5 (OCCI 11.2, Linux RHEL5.5, GCC4.1.2)
Problems with OCCI on Linux RHEL5.5 [message #533680] Thu, 01 December 2011 02:19
Falchion
Messages: 1
Registered: December 2011
Location: Sweden
Junior Member
Hi,

I've got a problem that I have spent days trying to solve. Now I'm stumped and in need of some help/input from you.

Some background:
I have a multithreded (POSIX) application that has been running on 32-bit Linux server for years without any serious problems, a few weeks ago it was ported to 64-bit RHEL 5.5 (compiled with -m32 flag). Now with the application in the new environment some processes are growing in memorysize, and some crash with segmentation fault after been running for a day or so.
I have tried to pinpoint the memory leak with Valgrind and have numerous leaks reported in "libclntsh.so" and "libnnz11.so".
There is also reports about race conditions with Helgrind and DRD, also connected with the "libclntsh.so".

There has been quite a few changes due to the new server. New compiler (gcc) from version 2.96 to 4.1.2, new version of oracle client 10g to 11g (11.2.0.2), new version of OCCI (also 11.2.0.2). The applications sourcecode is pretty much unchanged though, and that is why I turn to all of you for help.

Right now I'm not sure if this is a OCCI or Linux problem.

This is a simplified version to recreate the problem:
#include <iostream>
#include <string>
#include <occi.h>

using namespace oracle::occi;
using namespace std;

Environment *env;
ConnectionPool *connPool;
Connection *con;
int x, loopnr;

string usr = "test_user";
string pwd = "test_pw";
string url = "dbtest";

void run(int x) { // Run loops
  for(int i=0; i<x; i++){ // Loop connect and disconnect x number of times
    try {
      fflush(stdout); // Update console row for count value
      con = connPool->createConnection (usr, pwd); // Connect
      usleep(100000);
      connPool->terminateConnection (con); // Disconnect
      cout << "\r"; // Update console row for count value
      cout << loopnr << endl; // Print number of loops done
      usleep(100000);
      loopnr++; // Count number of loops done
    }
    catch(SQLException ex) { // Exception handling
    cout<<"SQLException"<<endl;
    cout<<"Error number: "<< ex.getErrorCode() << endl;
    cout<<ex.getMessage() << endl;
    }
  }
}

int main(int argc,char* argv[]) {
  cout << "IN --- main()\n";
  if(argc == 2) { // Read number of loops as argument...
    x = atoi(argv[1]);
  }
  else { // ...or run loop 200 times if no args
    x = 200;
  }
  try{
    env = Environment::createEnvironment(Environment::THREADED_MUTEXED); // Create environment
    loopnr = 1;
    connPool = env->createConnectionPool(usr, pwd, url, 1, 2, 1); // Create pool
    run(x); // Run loops
  }
  catch(SQLException ex) { // Exception handling
    cout<<"SQLException"<<endl;
    cout<<"Error number: "<< ex.getErrorCode() << endl;
    cout<<ex.getMessage() << endl;
  }
  env->terminateConnectionPool (connPool); // Cleanup Pool when done
  Environment::terminateEnvironment (env); // Cleanup Environment when done
  cout << "\nUT --- main()\n";
  return 0;
}


Above code compiled/linked with the following makefile:

ORACLE_HOME=/opt/oracle/product/32bit-client-11.2.0.2

CXXFLAGS = -Wall -m32 -g -fPIC \
-I$(ORACLE_HOME)/rdbms/public

LDLIBS = -L$(ORACLE_HOME)/lib/ -locci \
-L$(ORACLE_HOME)/rdbms/lib/ -lclntsh
LDFLAGS = -m32

default: all

Sample: Sample.cc

all: Sample

clean: rm -f Sample *.o

Can someone provide some insight in this? Am I the only one that experience this problem?

[Updated on: Thu, 01 December 2011 04:21]

Report message to a moderator

Previous Topic: Error inserting XML records > 4000 bytes
Next Topic: oracle Pro C (2 Merged)
Goto Forum:
  


Current Time: Thu Mar 28 06:43:00 CDT 2024