Home » Developer & Programmer » Precompilers, OCI & OCCI » multithread program hangs in Oracle Library on Itanium
multithread program hangs in Oracle Library on Itanium [message #119591] Fri, 13 May 2005 08:38 Go to next message
fabia
Messages: 1
Registered: May 2005
Junior Member

my Multithread-Program hangs in an oracle library while passing a prepare statement (also if i try an EXEC SQL SELECT statement...).
Something seems to be wrong in the Program, but i cant's find the Error... Mad
Perhaps somebody knows the Problem an can help me??? Razz


The Program is build with:

proc parse=none code=cpp mode=oracle hold_cursor=yes maxopencursors=20 THREADS=YES sqlcheck=full iname=Precomp_all.pc oname=Precomp_all.h

problem:

a first thread creates the connection to oracle with one global context (type sql_context) in the connection object:

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;

// 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 connection obeject of the first thread.
Later the thread calls a prepare, but it 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);

// convert the statement in oracle
CString stmt = connection->nativeSQL(statement);

// 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
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:"+stmtStr, "", sqlca.sqlcode);
}

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

if(0 > sqlca.sqlcode)
{
CString stmtStr(dyn_stmt);
if(dyn_stmt)
{
delete[] dyn_stmt;
dyn_stmt = NULL;
}
throw SQL_EXCEPTION(errorMessage+", statement:"+stmtStr, "", 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;
}

debug info:

(gdb) thread 2
[Switching to thread 2 (system thread 6898811)]
#0 0x9fffffffbe7edfe0:1 in nsrdr+0x31 () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0
(gdb) bt
#0 0x9fffffffbe7edfe0:1 in nsrdr+0x31 () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0
#1 0x9fffffffbe7b34c0:0 in nsdo+0x34e0 () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0
#2 0x9fffffffbe8100e0:0 in nioqrc+0x330 () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0
#3 0x9fffffffbeb869a0:0 in ttcdrv+0x960 () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0
#4 0x9fffffffbe8199d0:0 in nioqwa+0xf0 () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0
#5 0x9fffffffbe52b5f0:0 in upirtrc+0x740 () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0
#6 0x9fffffffbe479920:0 in kpurcsc+0xe0 () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0
#7 0x9fffffffbe3dbbc0:0 in kpuexecv8+0x1560 () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0
#8 0x9fffffffbe3e1690:0 in kpuexec+0x1b50 () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0
#9 0x9fffffffbe4c69c0:0 in OCIStmtExecute+0x60 () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0
#10 0x9fffffffbe368700:0 in sqlcucParse+0x1c0 () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0
#11 0x9fffffffbe38fdd0:0 in sqlos2t+0x350 () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0
#12 0x9fffffffbe3572f0:0 in sqlopr+0x1350 () from /app/oracle/product/9.2.0/lib/libclntsh.so.9.0
#13 0x9fffffffbe3368c0:0 in sqlnst+0xa860 () 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+0xa0 () 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:1439
#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:1246


Thanks in advance!!
Re: multithread program hangs in Oracle Library on Itanium [message #147560 is a reply to message #119591] Fri, 18 November 2005 03:59 Go to previous messageGo to next message
goonct
Messages: 1
Registered: November 2005
Junior Member
Hi,

I also faced the same problem as you. Have you solved the problem ?

I am running in Linux Redhat Enterprise 3, Oracle 10.2, and application written in pro-c. Below is the information get from core file.

(gdb) where
#0 0x00000000 in ?? ()
#1 0x01447dd6 in ttcdrv () from /u01/oracle/OraHome_1/lib/libclntsh.so.10.1
#2 0x012e9561 in nioqwa () from /u01/oracle/OraHome_1/lib/libclntsh.so.10.1
#3 0x0115b132 in upirtrc () from /u01/oracle/OraHome_1/lib/libclntsh.so.10.1
#4 0x010f1de9 in kpurcsc () from /u01/oracle/OraHome_1/lib/libclntsh.so.10.1
#5 0x010ae0ba in kpuexecv8 () from /u01/oracle/OraHome_1/lib/libclntsh.so.10.1
#6 0x010b0460 in kpuexec () from /u01/oracle/OraHome_1/lib/libclntsh.so.10.1
#7 0x01124c3a in OCIStmtExecute ()
from /u01/oracle/OraHome_1/lib/libclntsh.so.10.1
#8 0x010625c5 in sqlcucExecute ()
from /u01/oracle/OraHome_1/lib/libclntsh.so.10.1
#9 0x01054bbb in sqlall () from /u01/oracle/OraHome_1/lib/libclntsh.so.10.1
#10 0x0105a8eb in sqlatm () from /u01/oracle/OraHome_1/lib/libclntsh.so.10.1
#11 0x0104d009 in sqlnst () from /u01/oracle/OraHome_1/lib/libclntsh.so.10.1
#12 0x01037d1f in sqlcmex () from /u01/oracle/OraHome_1/lib/libclntsh.so.10.1
#13 0x010381e0 in sqlcxt () from /u01/oracle/OraHome_1/lib/libclntsh.so.10.1
#14 0x08050545 in db_check_sub (db_ctx_no=8, szmsisdn=0xabf78ac "60120349885",
picos_id=0xabf7958, pisub_type=0xabf7954) at sssgw_db.c:997
#15 0x0804d611 in cmd_ISUPIF_MC (req=0xabf7874, res=0xabf7904, thread_no=8)
at sssgw_thread.c:350
#16 0x0804d3ea in db_proc (msg_proc=0xabf7870, thread_no=8)
at sssgw_thread.c:271
#17 0x0804cf85 in dbc_thread (arg=0x8) at sssgw_thread.c:247

rgds
Re: multithread program hangs in Oracle Library [message #179382 is a reply to message #147560] Tue, 27 June 2006 04:40 Go to previous messageGo to next message
alexdc
Messages: 1
Registered: June 2006
Junior Member
I also faced the same problem as you but with proC.
System is Linux Redhat Enterprise 3, Oracle 10.1.

The statement is a plain SELECT statement.
(we also hand various problems regarding Linux Redhat Enterprise)

Hre the gdb stack:
#0 0xb6e14631 in nsprecv () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#1 0xb6e178f2 in nsrdr () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#2 0xb6dfa9bc in nsdo () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#3 0xb6e2952c in nioqrc () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#4 0xb6f869b6 in ttcoac () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#5 0xb6f89c20 in ttcrbur () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#6 0xb6f8a5bb in ttcbur () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#7 0xb6f8970e in ttcrbur () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#8 0xb6f8a5bb in ttcbur () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#9 0xb6c040c1 in kpuexCallback () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#10 0xb6f6463e in ttcdrv () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#11 0xb6e30505 in nioqwa () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#12 0xb6cb1d12 in upirtrc () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#13 0xb6c489c9 in kpurcsc () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#14 0xb6c054c5 in kpuexecv8 () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#15 0xb6c07040 in kpuexec () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#16 0xb6c7b81a in OCIStmtExecute () from /home/oracle10/app/oracle/product/10.1.0/lib/libclntsh.so.10.1
#17 0x080a6b21 in sqlcucExecute ()
#18 0x08097ade in sqlall ()
#19 0x0809e313 in sqlatm ()
#20 0x0808c81b in sqlnst ()
#21 0x0807a44b in sqlcmex ()
#22 0x0807a90c in sqlcxt ()
#23 0x08050490 in lire_demande_calcul (demande=0xbfffac50 "") at serv_calcul.c:5582
Re: multithread program hangs in Oracle Library on Itanium [message #332890 is a reply to message #119591] Thu, 10 July 2008 00:58 Go to previous message
arindamc
Messages: 1
Registered: July 2008
Junior Member
I am also facing similar type of issue on LinuxIA64. In multi threaded environment there is core dump after some time. Can anyone has any solution. Following is the stack trace:

(gdb) #0 0x2000000006b1fb90 in memchr () from /lib/tls/libc.so.6.1
#1 0x200000000e26c010 in ttcs2c ()
from /opt/ora101/OraHome_1/lib/libclntsh.so.10.1
#2 0x200000000d4b7990 in $_1$ttcacs$TAG$GLOB ()
from /opt/ora101/OraHome_1/lib/libclntsh.so.10.1
#3 0x200000000e232760 in $_1$ttcdrv$TAG$GLOB ()
from /opt/ora101/OraHome_1/lib/libclntsh.so.10.1
#4 0x200000000d1dce30 in nioqwa ()
from /opt/ora101/OraHome_1/lib/libclntsh.so.10.1
#5 0x200000000e0f3d40 in upirtrc ()
from /opt/ora101/OraHome_1/lib/libclntsh.so.10.1
#6 0x200000000e0cc8e0 in kpurcsc ()
from /opt/ora101/OraHome_1/lib/libclntsh.so.10.1
#7 0x200000000e0739d0 in kpuexecv8 ()
from /opt/ora101/OraHome_1/lib/libclntsh.so.10.1
#8 0x200000000e077690 in kpuexec ()
from /opt/ora101/OraHome_1/lib/libclntsh.so.10.1
#9 0x200000000e0e4fa0 in OCIStmtExecute ()
from /opt/ora101/OraHome_1/lib/libclntsh.so.10.1
#10 0x200000000ca3a500 in TOracleStatement::executenormal ()
Previous Topic: More infos about insert which calls ODCIIndexInsert?
Next Topic: Issue with Pro*C/C++ 10.2.0.2 application
Goto Forum:
  


Current Time: Sat Dec 10 09:20:51 CST 2016

Total time taken to generate the page: 0.13176 seconds