Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everybody,

I have a big issue. I searched a lot in internet, but could't find anything, that answered my question.

Givens:
1- The application is written in C++.
2- The application is multithreaded.
3- The application communicates with oracle 10g DB engine using otlv4 library.
4- The preprocessors used before including otlv4.h are:
"#define OTL_ORA10G_R2 // Compile OTL 4.0/OCI10gR2"
"#define OTL_STL"

5- The platform is Unix, Solaris 10.

The problem is:
- One of the working threads block upon invoking a stored procedure and never come back.
- This happens randomly on different times.
- There are no exceptions thrown even after a long time of invocation.

Objective:
1- I need to know why this occurs and what are the possible reasons beyond this.
2- I also appreciate and advice on how to handle this problem other than monitoring threads.

Thanks in advance.
Posted

1 solution

You are using one connection/session per thread?

Based on your "problem" description, I suspect that you have concurrency issues.

Personally I prefer using Oracle C++ Call Interface[^]

For more info on OCI (used by OTL) see
http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28395/toc.htm[^]

>>One of the working threads block
>>upon invoking a stored procedure and never come back.
>>This happens randomly on different times.
>>There are no exceptions thrown even after a long time of invocation.

From your description I feel that "the symptoms" are consistent with a subtle concurrency bug, but that's just my feeling...

About five years ago I played a bit around with OTL and Oracle, I ended up using C++ Builder with Direct Oracle Access from Allround Automations. Obviously that option isn't available to you. While I initially invested a lot of work in the OTL based approach I never became really happy with the result, feeling that to much was out of my control.

IMHO: OTL tries far to hard to present the user with a C++ish api, which I feel isn't quite as readable as code based on Oracle C++ Call Interface. OCCI may seem a bit javaish, but it's quite clear what's going on in your code. I would guess OCCI is also used in a lot more production scenarios than OTL, but that's an unqualified guess.

I've developed a number of multithreaded server applications using Oracle as the RDBMS. I've worked directly with OCI and I've used OCCI, solutions based on both approaches has proven to be very stable once I have them working. Those applications relied heavily on ACE[^], and ACE has pretty serious error handling and logging features, that has enabled me to detect errors, find their location and fix them pretty fast.

I haven't a clue about what's wrong with your application, but gave it a best shot based on very little information from your side.

Best of luck
Espen Harlinn
 
Share this answer
 
v4
Comments
caesar_etos 6-Jan-11 10:30am    
Yes, I have one connection object for each thread.
CPallini 6-Jan-11 15:56pm    
@Espen: I have the same feeling about the symptoms.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900