I have hosted an webservice in WAS residing in an AIX box. I'm handling DB connections(DB2) for my app tho' native C code. In some case, if 1 thread is getting the context as 0 when sqleBeginCtx(&context,SQL_CTX_BEGIN_ALL,NULL,$sqlca) API call is made and it makes the thread not able to open connection to DB and subsequently leading to close thread with exceptions.
My application is configured with 25 threads to handle i/p requests concurrently. In above mentioned scenario after the thread gets failed bcos of improper context (i.e 0 instead of valid context) and when the same thread comes in roundrobin basis for next request execution it will be given the same context(as context memory will be given in rounrobin as I have 25 DB connections) and when the thread call sqleAttachCtx the thread goes to hung state. I'm not sure whether the 2nd time call to sqleBeginCtx()was returned with a junk value and sqleAttachCtx is trying to use the junk context returned tho' the sqleBeginCtx call ?
Can you guys help me to understand because of what reason we will get the context as 0? Also when we make DB2 API calls like sqleAttachCtx and sqleBeginCtx() whether timeout is there?
Im restarting the WAS JVM everytime to fix the problem of hung threads.