Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> HP-UX on Itanium and Oracle

HP-UX on Itanium and Oracle

From: uf <uf_at_one.com>
Date: Fri, 13 May 2005 11:22:24 +0200
Message-ID: <d61rkn$ler$1@domitilla.aioe.org>


Hello.

We have following problem: multithreading program is using 99% of the CPU and it gets stucked.

The multithreading program is built with the proc options: proc parse=none code=cpp mode=oracle hold_cursor=yes maxopencursors=20 THREADS=YES SQLCHECK=full iname=Precomp_all.pc oname=Precomp_all.h

The first thread etablishes the connection with the COMMAND ENADLE THREADS and an global context (type: sql_context):

connect()
{

  EXEC SQL WHENEVER SQLERROR   DO ORASQL_ERROR();
  EXEC SQL WHENEVER SQLWARNING DO ORASQL_WARNING();
  EXEC SQL WHENEVER NOTFOUND   DO ORASQL_NOP();

// Enable thread processing.
// This is necessary to be able to operate on the database asynchronously
// while being hang in the wait for an alert.
  EXEC SQL ENABLE THREADS;
  if(0 > sqlca.sqlcode)
  {
    throw SQL_EXCEPTION(errorMessage, "", sqlca.sqlcode);   }

// allocate the default context

  EXEC SQL CONTEXT ALLOCATE :context;
  if(0 > sqlca.sqlcode)
  {
    throw SQL_EXCEPTION(errorMessage, "", sqlca.sqlcode);   }

// Use the default context from now on.
  EXEC SQL CONTEXT USE :context;

  PLogfile->Log(LOG_DEBUG, (CString)"****** Connection:");
// connecting to database.

  EXEC SQL CONNECT :oracleUsername IDENTIFIED BY :oraclePassword USING :oracleInstance;
  if(0 > sqlca.sqlcode)
  {
    throw SQL_EXCEPTION(errorMessage, "", sqlca.sqlcode);   }
}

A second thread tries to send a prepare-Statement to the database. This thread gets the context of the first thread and hangs in the execution of EXEC SQL PREPARE prep_stmt FROM :dyn_stmt;:

prepare()
{

  EXEC SQL WHENEVER SQLERROR   DO ORASQL_ERROR();
  EXEC SQL WHENEVER SQLWARNING DO ORASQL_WARNING();
  EXEC SQL WHENEVER NOTFOUND   DO ORASQL_NOP();
  EXEC SQL CONTEXT  USE        :context;

// get the amount of parameters

  parameterCount =
statement.CountDelimiter(SQL_ORACLE_PARAMETER_PLACE_HOLDER);   PLogfile->Log(LOG_DEBUG, (CString)"Amount of parameters: " parameterCount);

// convert the statement in oracle

  CString stmt = connection->nativeSQL(statement);   PLogfile->Log(LOG_DEBUG, (CString)"To oracle converted statement: " stmt);

// copy the statement in oracle declared variable
  dyn_stmt = new char[stmt.Length() 1];

  strcpy(dyn_stmt, stmt.c_str());

// allocate space for the bind descriptor
  bind_des = SQLSQLDAAlloc(&context, parameterCount,

                           (size_t)SQL_ORACLE_PARAMETER_MAX_NAME,
                           (size_t)SQL_ORACLE_PARAMETER_MAX_IND_NAME);

// Next, you set the maximum number of placeholders that can be DESCRIBEd
  bind_des->N = parameterCount;

// declare and prepare the statement

  PLogfile->Log(LOG_DEBUG, (CString)"Prepare statement:");   EXEC SQL PREPARE prep_stmt FROM :dyn_stmt;

   if(0 > sqlca.sqlcode)
  {
    CString stmtStr(dyn_stmt);
    if(dyn_stmt)
    {

      delete[] dyn_stmt;
      dyn_stmt = NULL;

    }
    throw SQL_EXCEPTION(errorMessage", statement:"??, "", sqlca.sqlcode);   }

  PLogfile->Log(LOG_DEBUG, (CString)"PREPARE: erfolgreich!!");

// describe bind vars

  PLogfile->Log(LOG_DEBUG, (CString)"Bind Variables: " bind_des);   EXEC SQL DESCRIBE BIND VARIABLES FOR prep_stmt INTO bind_des;

  PLogfile->Log(LOG_DEBUG, (CString)"SQLCODE: " sqlca.sqlcode);

  if(0 > sqlca.sqlcode)
  {
    CString stmtStr(dyn_stmt);
    if(dyn_stmt)
    {

      delete[] dyn_stmt;
      dyn_stmt = NULL;

    }
    throw SQL_EXCEPTION(errorMessage", statement:"??, "", sqlca.sqlcode);   }

// Next, you must reset the maximum number of placeholders to the number
// actually found by DESCRIBE

  PLogfile->Log(LOG_DEBUG, (CString)"Reset bind variables: " bind_des->F);

  bind_des->N = bind_des->F;

}

we found out, that the programm hangs in the Oracle-Library-Funktion nsrdr:

  (gdb) thread 2
  [Switching to thread 2 (system thread 6898811)]   #0 0x9fffffffbe7edfe0:1 in nsrdr? () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   (gdb) bt
  #0 0x9fffffffbe7edfe0:1 in nsrdr? () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   #1 0x9fffffffbe7b34c0:0 in nsdo?? () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   #2 0x9fffffffbe8100e0:0 in nioqrc? () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   #3 0x9fffffffbeb869a0:0 in ttcdrv? () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   #4 0x9fffffffbe8199d0:0 in nioqwa? () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   #5 0x9fffffffbe52b5f0:0 in upirtrc? () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   #6 0x9fffffffbe479920:0 in kpurcsc? () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   #7 0x9fffffffbe3dbbc0:0 in kpuexecv8?? () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   #8 0x9fffffffbe3e1690:0 in kpuexec?? () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   #9 0x9fffffffbe4c69c0:0 in OCIStmtExecute? () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   #10 0x9fffffffbe368700:0 in sqlcucParse? () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   #11 0x9fffffffbe38fdd0:0 in sqlos2t? () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   #12 0x9fffffffbe3572f0:0 in sqlopr?? () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   #13 0x9fffffffbe3368c0:0 in sqlnst?? () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   #14 0x9fffffffbe308190:0 in <unknown_procedure> 0x770 () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   #15 0x9fffffffbe308d80:0 in sqlcxt? () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0   #16 0x40000000002d2a90:0 in OraclePreparedStatement::prepare (this=0x60000000004f4f20) at
/eplus/EAI/src_itanium/libs/cascadelib/templates/sql/oracle/Precomp_all.h:14 39

  #17 0x40000000002cf950:0 in
OraclePreparedStatement::OraclePreparedStatement (this=0x60000000004f4f20, #VLDVtableTablePtr#129=0x6000000000023720, PTheLogfile=0x60000000000578f0, connection=0x6000000000313560, statement=@0x9fffffffbd968000) at /eplus/EAI/src_itanium/libs/cascadelib/templates/sql/oracle/Precomp_all.h:12 46

  #18 0x40000000002d9180:0 in
OracleCallableStatement::OracleCallableStatement (this=0x60000000004f4f20, #VLDVtableTablePtr#297=0x6000000000023718, PTheLogfile=0x60000000000578f0, connection=0x6000000000313560, statement=@0x9fffffffbd968000) at /eplus/EAI/src_itanium/libs/cascadelib/templates/sql/oracle/Precomp_all.h:18 69

  #19 0x40000000002e7be0:0 in OracleConnection::prepareCall (this=0x6000000000313560, sql=@0x9fffffffbd968000) at /eplus/EAI/src_itanium/libs/cascadelib/templates/sql/oracle/Precomp_all.h:25 92

  #20 0x40000000001e7740:0 in CCacOutputSql::procedureCall (this=0x6000000000080f40, sCommand=@0x9fffffffbd968ab0, psResponse=0x9fffffffbd968d10) at
/eplus/EAI/src_itanium/libs/cascadelib/interfaces/ccacoutputsql.cpp:606

  #21 0x40000000001dd8c0:0 in CCacOutputSql::Dialog (this=0x6000000000080f40, sCommand=0x9fffffffbd968ab0, psResponse=0x9fffffffbd968d10) at
/eplus/EAI/src_itanium/libs/cascadelib/interfaces/ccacoutputsql.cpp:413

  #22 0x40000000001844c0:0 in CCacOutput::Dialog (this=0x600000000006f760, sCommand=0x9fffffffbd968be0, psResponse=0x9fffffffbd968d10) at /eplus/EAI/src_itanium/libs/cascadelib/interfaces/ccacoutput.cpp:414

  #23 0x40000000000b5440:0 in CCacXmlProcessor::SendCommand (this=0x6000000000212920, sCommand=0x9fffffffbd968dd0) at /eplus/EAI/src_itanium/libs/cascadelib/cacd/ccacxmlprocessor.cpp:891

  #24 0x40000000000b2950:0 in CCacXmlProcessor::ExecuteGp (this=0x6000000000212920, sGpName=@0x60000000004362b0) at /eplus/EAI/src_itanium/libs/cascadelib/cacd/ccacxmlprocessor.cpp:749

  #25 0x40000000000a4350:0 in CCacXmlProcessor::ProcessRequest (this=0x6000000000212920, PRequest=0x600000000030f150) at /eplus/EAI/src_itanium/libs/cascadelib/cacd/ccacxmlprocessor.cpp:163

  #26 0x400000000012e040:0 in CCacThread::ProcessRequest (this=0x600000000010a600) at
/eplus/EAI/src_itanium/libs/cascadelib/cacd/ccacthread.cpp:311

  #27 0x400000000028f490:0 in CCacInputFile::Run (this=0x6000000000078a20, PTheRequest=0x600000000030f150) at
/eplus/EAI/src_itanium/libs/cascadelib/listeners/ccacinputfile.cpp:794

  #28 0x400000000012e290:0 in CCacThread::Execute (this=0x600000000010a600) at /eplus/EAI/src_itanium/libs/cascadelib/cacd/ccacthread.cpp:326

  #29 0x4000000000174fb0:0 in CThread::InitializeThread (this=0x600000000010a600) at
/eplus/EAI/src_itanium/libs/cascadelib/utility/cthread.cpp:217

  #30 0x4000000000174d30:0 in CThread::ThreadMain (PThread=0x600000000010a600) at
/eplus/EAI/src_itanium/libs/cascadelib/utility/cthread.cpp:167

  #31 0x9fffffffbf701c00:0 in __pthread_bound_body? () from /usr/lib/hpux64/libpthread.so.1 Received on Fri May 13 2005 - 04:22:24 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US