Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

JDBC hangs on socketRead

Posted on 2002-07-12
8
Medium Priority
?
1,008 Views
Last Modified: 2008-02-07
I am running Oracle 8.1.7.4 on Red Hat Linux 7.2 smp.  When I connect through JDBC after a while it hangs as shown in the following thread dump

"jcp-21" prio=1 tid=0x0x84492c8 nid=0x7242 runnable [4e21c000..4e21d86c]
      at java.net.SocketInputStream.socketRead0(Native Method)
      at java.net.SocketInputStream.read(SocketInputStream.java:116)
      at oracle.net.ns.Packet.receive(Unknown Source)
      at oracle.net.ns.NetInputStream.getNextPacket(Unknown Source)
      at oracle.net.ns.NetInputStream.read(Unknown Source)
      at oracle.net.ns.NetInputStream.read(Unknown Source)
      at oracle.net.ns.NetInputStream.read(Unknown Source)
      at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine.java:931)
      at oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine.java:893)
      at oracle.jdbc.ttc7.Ocommoncall.receive(Ocommoncall.java:104)
      at oracle.jdbc.ttc7.TTC7Protocol.setAutoCommit(TTC7Protocol.java:538)
      - locked <0x447960f8> (a oracle.jdbc.ttc7.TTC7Protocol)
      at oracle.jdbc.driver.OracleConnection.setAutoCommit(OracleConnection.java:1220)
      - locked <0x44c400b0> (a oracle.jdbc.driver.OracleConnection)
      at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:478)
      at oracle.jdbc.pool.OraclePooledConnection.getConnection(OraclePooledConnection.java:292)
      - locked <0x447ebf18> (a oracle.jdbc.pool.OraclePooledConnection)
      at oracle.jdbc.pool.OracleConnectionCacheImpl.getConnection(OracleConnectionCacheImpl.java:302)
      - locked <0x447961e0> (a oracle.jdbc.pool.OracleConnectionCacheImpl)
      at oracle.jdbc.pool.OracleConnectionCacheImpl.getConnection(OracleConnectionCacheImpl.java:268)
      - locked <0x447961e0> (a oracle.jdbc.pool.OracleConnectionCacheImpl)
      at tkm.ConnectMgr.getCon(ConnectMgr.java:67)
      at tkm.beans.KnodeRep.getKnode(KnodeRep.java:152)
      at tkm.kn.KnavUserReqCrsCommand.execute(KnavUserReqCrsCommand.java:127)
      at tkm.kn.KnavServlet.service(KnavServlet.java:132)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1417)
      at allaire.jrun.session.JRunSessionService.service(JRunSessionService.java:1106)
      at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java:1271)
      at allaire.jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java:89)
      at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1557)
      at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1547)
      at allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java:364)
      at allaire.jrun.jrpp.ProxyEndpoint.run(ProxyEndpoint.java:388)
      at allaire.jrun.ThreadPool.run(ThreadPool.java:272)
      at allaire.jrun.WorkerThread.run(WorkerThread.java:75)


All the other threads are in the state "waiting for moniter entry" such as below:

"jcp-22" prio=1 tid=0x0x844aa58 nid=0x7243 waiting for monitor entry [4e29e000..4e29e86c]
      at oracle.jdbc.pool.OracleConnectionCacheImpl.getConnection(OracleConnectionCacheImpl.java:268)
      - waiting to lock <0x447961e0> (a oracle.jdbc.pool.OracleConnectionCacheImpl)
      at tkm.ConnectMgr.getCon(ConnectMgr.java:67)
      at tkm.beans.CourseIterationRep.getCoIter(CourseIterationRep.java:150)
      at tkm.kn.KnavOpenCrsCommand.execute(KnavOpenCrsCommand.java:83)
      at tkm.kn.KnavServlet.service(KnavServlet.java:132)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1417)
      at allaire.jrun.session.JRunSessionService.service(JRunSessionService.java:1106)
      at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java:1271)
      at allaire.jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java:89)
      at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1557)
      at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1547)
      at allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java:364)
      at allaire.jrun.jrpp.ProxyEndpoint.run(ProxyEndpoint.java:388)
      at allaire.jrun.ThreadPool.run(ThreadPool.java:272)
      at allaire.jrun.WorkerThread.run(WorkerThread.java:75)


It seems that all the other threads are waiting for a database connection, but because the moniter has that method locked by the thread that is apparently hung in the socketRead0 method, all the threads sit idle and wait.  I have verified this using JRun, Weblogic, and a simple java app without using an appserver.  I have reproduced this with IBM JVM 1.3.0, Sun JVM 1.3.1, 1.3.1_03, and 1.4.  I have also tried this with the following driver releases:
classes12.zip
classes12.jar
ojdbc14.jar

It is reproducable with both JDBC thin and OCI drivers.  

There are at least 2 messages about this on OTN, but no answers.  Can someone please help?  Thanks in advance!
0
Comment
Question by:rpolocz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 5

Expert Comment

by:fontaine
ID: 7151443
Could you please post a piece of code that demonstrates the problem (the smaller the better), preferrably a standalone app. Thx.
0
 
LVL 1

Expert Comment

by:yourbutler
ID: 7153240
Are you closing your connections (sockets)?  After you open, if you don't close it (a connection) will stay open (locked) for a certain period of time which is set on the server.  I had this problem once and I think that was part of the solution.  We were using pooling and needed to increase our pool too since we had so many connections coming in.  If you are not pooling then you
0
 
LVL 1

Author Comment

by:rpolocz
ID: 7155409
We already checked that we are closing all the connections.  We are using Oracle's implementation of Connection Pooling, and have set the max at 400.  In monitoring connections during the test, we don't get above 250.  
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:yourbutler
ID: 7155475
Oops, I meant that last one to be a comment.  Sorry about that.  There was some other thing that I cannot remember....something with the database though.  Seems like we did some upgrade or something with pooling.  
0
 
LVL 1

Author Comment

by:rpolocz
ID: 7157537
A test case is now available at ftp://guest:guest@65.114.254.21

I'm increasing the value of the question to 700 points, hoping for a quick resolution.

Thanks in advance!
0
 
LVL 1

Author Comment

by:rpolocz
ID: 7157547
Sorry, only lets me put 500 points on this question.  I added another question for 200 points at
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=java&qid=20323996

Use the test case to discover an answer and get 700 points total!
0
 
LVL 2

Accepted Solution

by:
keithlong earned 2000 total points
ID: 7240574
Why do people assume this is a Socket problem or a Java problem.

It's a database problem and a lot of people have encountered it in the past. Obviously your problem will not reproduce on my system for this reason different versions of Oracle different patches.

Try running the same query through SQL-PLUS in my experience it will fail. It can be caused by a bug in the Oracle Software, or alternatively oracle is accessing damaged data.

http://www.orafaq.com/archive/comp.databases.oracle.server/2002/05/08/146319.htm

If you had, looked at the comp.databases.oracle threads, you would see someone has had something similar before.

I would advise, you to check your program against another version of Oracle if you have. If not attempt to patch your oracle version.

It is possible if you have an Oracle support contract, that this is the time to use it. I could be wrong, but I have been here in the past.

Hope this helps:
Regards

Keith Long
www.technogenius.co.uk
0
 
LVL 35

Expert Comment

by:girionis
ID: 8917316
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- points to  keithlong

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question