6 Replies Latest reply on Aug 26, 2002 11:02 PM by David Jencks

    Opening new database connection => " Interrupted while reque

    Dietmar Schinnerl Newbie

      Hi,

      Environment: JBoss 3.0.1/Jetty, mm.mysql 2.0.14

      If I run a light load test on our web application some database connection opens fail with:

      [...]
      07:28:00,450 ERROR [DataBaseAccessor] openConnection
      org.jboss.util.NestedSQLException: Interrupted while requesting permit!; - nested throwable: (javax.resource.ResourceException: Interrupted while requesting permit!)
      at org.jboss.resource.adapter.jdbc.local.LocalDataSource.getConnection(LocalDataSource.java:106)
      at com.webdynamite.util.database.Database.getConnection(Database.java:156)
      [...]

      I have no idea what's the cause of this problem. However I changed the code to try to open the database connection a second time if the first try throws an exception. The second try works without problems if the first fails. (So, I have at least a workaround, but I don't really like it to do it that way.)

      Thank your for help or hints.

      Best regards,
      Dietmar

      PS: I'm rather sure that this is the wrong forum, but I didn't find a better one.

      PS(2): Is there a searchable mailinglist archive somewhere? Geocrawler doesn't seem to have a search interface. :-(

        • 1. Re: Opening new database connection => " Interrupted while r
          David Jencks Master

          This should be fixed in all cvs versions. It was a jetty bug.

          • 2. Re: Opening new database connection => " Interrupted while r
            Dietmar Schinnerl Newbie

            Hi David,

            thank you very much!

            Best regards,
            Dietmar

            • 3. Re: Opening new database connection => " Interrupted while r
              Ralph Roland Newbie

              I'm encountering the same "Interrupted while requesting permit!" error with JBoss3.0.1/Jetty connecting to a MSSQLServer datasource. My question is "is there a way to get the fix, without stepping up to the very latest-and-greatest code in CVS?".

              Apologies in advance if this is the wrong forum, or just a stupid question, but I've read the developer and cvs guides and faqs and haven't been able to figure out how to get this fix...

              I've tried pulling and building the latest from cvs - this gives me JBoss 4.0.0.alpha (which is a little too bleeding edge for me). I've pulled and built the JBoss_3_0_1 label from cvs. This build appears to be exactly the same as the 3.0.1 release (as I would expect) and exhibits the problem. Is there any way to get this fix against the (presumably stable) 3.0.1 codebase?

              Once again, sorry if this is a dumb question - and any pointers will be greatly appreciated.

              Thanks!
              Ralph

              • 4. Re: Opening new database connection => " Interrupted while r
                David Jencks Master

                I think you want to

                cvs ... co -rBranch_3_0 jboss-all

                to get the latest on the 3.0 branch (nearly 3.0.2)

                You can also try the 3.2 branch (... -rBranch_3_2 ...) but it is nearly the same as 4.0... but it does have waaaaaay simpler datasource configuration.

                Both of these should get releases in the next couple of days.

                • 5. Re: Opening new database connection => " Interrupted while r
                  Ralph Roland Newbie

                  David - thanks very much for the pointer! That was exactly what I needed...

                  Unfortunately (for me at least) the 3.0 Branch (3.0.2RC1) seems to exhibit the same problem. After a little digging (and copious printlns) I'm fairly certain the basic problem is caused by the executing Thread being interrupted at some point, and not being 'reset' (by having it's interrupted() method invoked). This causes the method call to FIFOSemaphore.attempt() in InternalManagedConnectionPool to fail fast - leading to the ResourceException being thrown. I verified that calling interrupted() on the current Thread before calling the FIFOSemaphore.attempt() method appears to solve (or at least mask) the problem.

                  Following David's lead of it being a Jetty problem I did a diff between the latest code and the Branch_3_0 code, then did a search for any new calls to interrupted(). Sure enough, found one in the org.mortbay.util.ThreadPool class (in the main loop of the run() method). Adding this single line to the 3_0 codebase ThreadPool class appears to resolve the problem.

                  So, I suppose I can get past my problem by simply making this single line change and rebuilding, but is there any way I can help ensure this change makes it into the 3.0.2 release? (Assuming that whoever is 'responsible' for the Jetty code agrees that the change is appropriate?) SourceForge appears to be down right now, when it comes back I'll take a look at submitting a Patch - hopefully that's the right approach.

                  On a side note, I'm surprised that only a few people seem to have encountered this problem. I'm getting it consistently within a few minutes of running our application.

                  Anyway, thanks again David for your help - it was just what I needed.
                  Ralph