views:

3795

answers:

2

We are running our Junit 4 test suite against Weblogic 9 in front of an Oracle 10 database (using Hudson as a continuous integration server) and occasionally we will get an ORA-12519 crash during script teardown. However, the error is very intermittent:

  • It usually happens for the same Test class
  • It doesn't always happen for the same test cases (sometimes they pass)
  • It doesn't happen for the same number of test cases (anywhere from 3-9)
  • Sometimes it doesn't happen at all, everything passes

While I can't guarantee this doesn't happen locally (when running against the same database, of course), I have run the same suite of class multiple times with no issues.

Any ideas?

A: 

from http://ora-12519.ora-code.com/

ORA-12519: TNS:no appropriate service handler found
Cause: The listener could not find any available service handlers that are appropriate for the client connection.
Action: Run "lsnrctl services" to ensure that the instance(s) have registered with the listener, and are accepting connections.

warren
I did that google search too. I'm wondering what could cause it so unpredictably.
cynicalman
cynicalman: then my answer isn't 'wrong', it's a start :) ... other information needs to be provided here, like where is the db server (same box, remote?), exact edition of Oracle, including any patches; have you checked Oracle's knowledge base and bug reports?
warren
+3  A: 

Don't know if this will be everybody's answer, but after some digging, here's what we came up with.

The error is obviously caused by the fact that the listener was not accepting connections, but why would we get that error when other tests could connect fine (we could also connect no problem through sqlplus)? The key to the issue wasn't that we couldn't connect, but that it was intermittent

After some investigation, we found that there was some static data created during the class setup that would keep open connections for the life of the test class, creating new ones as it went. Now, even though all of the resources were properly released when this class went out of scope (via a finally{} block, of course), there were some cases during the run when this class would swallow up all available connections (okay, bad practice alert - this was unit test code that connected directly rather than using a pool, so the same problem could not happen in production).

The fix was to not make that class static and run in the class setup, but instead use it in the per method setUp and tearDown methods.

So if you get this error in your own apps, slap a profiler on that bad boy and see if you might have a connection leak. Hope that helps.

cynicalman