glassfish
  1. glassfish
  2. GLASSFISH-8268

In-use connections equal max-pool-size using EJB Timer

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: v2.1.1
    • Fix Version/s: not determined
    • Component/s: jdbc
    • Labels:
      None
    • Environment:

      Operating System: Windows XP
      Platform: All

    • Issuezilla Id:
      8,268
    • Status Whiteboard:
      Hide

      V2.1.1_exclude

      Show
      V2.1.1_exclude

      Description

      I use Sun Java System Application Server 9.1_02. In my test enterprise
      application I use EJB TimerService with a 10-connections pool on MySQL in witch
      I created a database containing the EJB_TIMER_TBL table.
      Here are my test classes:

      //SessionBean which uses TimerService
      @Stateless
      public class NewSessionTimerBean implements NewSessionTimerLocal {
      @Resource
      TimerService timerService;
      @Timeout
      public void timeout(Timer timer) {
      System.out.println((String)timer.getInfo()+": BEGIN Timeout
      >>>>>>>>>>");
      try

      { Thread.sleep(1000000); }

      catch (InterruptedException ex)

      { Logger.getLogger(NewSessionTimerBean.class.getName()).log(Level.SEVERE, null, ex); }

      System.out.println((String)timer.getInfo()+": END Timeout<<<<<<<<<<");
      }
      public void create(String name, long time, long interval)

      { timerService.createTimer(new Date(time), interval, name); }

      public Vector getAllTimers(){
      Vector<String> ret = new Vector();
      Collection c = timerService.getTimers();
      Iterator<Timer> it = c.iterator();
      while(it.hasNext())

      { ret.add((String)it.next().getInfo()); }

      return ret;
      }

      public void delete(String name) {
      Iterator<Timer> it = timerService.getTimers().iterator();
      while(it.hasNext()){
      Timer tmp = it.next();
      String tmpName = (String)tmp.getInfo();
      if(name.equals(tmpName))

      { tmp.cancel(); break; }

      }
      }
      }

      //My Servlet

      ....

      protected void processRequest(HttpServletRequest request, HttpServletResponse
      response)
      throws ServletException, IOException {
      response.setContentType("text/html;charset=UTF-8");
      PrintWriter out = response.getWriter();
      try {
      if(request.getParameter("create") != null)

      { Date now = new Date(); String name = "timer" + now.getTime(); newSessionTimerBean.create(name, now.getTime()-100000, 10000); out.println("Creato Timer " + name + "\n"); }

      if(request.getParameter("delete") != null)

      { Date now = new Date(); String name = request.getParameter("name"); newSessionTimerBean.delete(name); out.println("Deleted Timer " + name + "\n"); }

      Vector timers = newSessionTimerBean.getAllTimers();
      Iterator it = timers.iterator();
      out.println("Timers list: " + "\n");
      out.println("<ul>");
      while(it.hasNext())

      { out.println("<li>"); String tmp = (String)it.next(); out.println("<a href=\"manage?delete&name="+tmp+"\">" + tmp + "</a>\n"); out.println("</li>"); }

      out.println("</ul>");
      } finally

      { out.close(); }

      }

      ....

      If i call the method timer.cancel(), by calling
      newSessionTimerBean.delete(name), on a timer which is running @Timeout-annoted
      method the timer raw on MySQL is deleted but the connection is not released. So
      if I create 7 timers and delete them before @Timeout-annoted method ends, and
      then create 4 new timers an Error is thrown (I have only 4 timers but the
      max-pool-size is 10):

      Error in allocating a connection. Cause: In-use connections equal max-pool-size
      and expired max-wait-time. Cannot allocate more connections.]

      In my test application @Timeout-annoted method executes Thread.sleep(1000000) so
      I can stop the timer before the method ends.

      Logging SQL instructions on MySQL server i noted that when @Timeout-annoted
      method starts a transaction is began ('XA START') but if I call timer.cancel()
      before the method ends the transaction is NOT ENDED ('XA END'), it may be the
      problem?
      If I restart Glassfish connections in the pool are released.

      I'm sorry for my English! Thanks

        Activity

        Hide
        Jagadish added a comment -

        transferring to Shalini for investigation

        Show
        Jagadish added a comment - transferring to Shalini for investigation
        Hide
        Ed Bratt added a comment -

        Will not fix in v2.1.1

        Show
        Ed Bratt added a comment - Will not fix in v2.1.1
        Hide
        jagadesh added a comment -

        Will not be fixed for V2.1.1

        Show
        jagadesh added a comment - Will not be fixed for V2.1.1
        Hide
        jagadesh added a comment -

        Will not be fixed for V2.1.1

        Show
        jagadesh added a comment - Will not be fixed for V2.1.1
        Hide
        Tom Mueller added a comment -

        Bulk update to change fix version to "not determined" for all issues still open but with a fix version for a released version.

        Show
        Tom Mueller added a comment - Bulk update to change fix version to "not determined" for all issues still open but with a fix version for a released version.

          People

          • Assignee:
            sfelts
            Reporter:
            jsantinizer
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: