glassfish
  1. glassfish
  2. GLASSFISH-19715

Abnormal commit/rollback of global transaction in task submitted to ManagedExecutorService

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0_b77
    • Fix Version/s: 4.0_b79
    • Component/s: concurrency
    • Labels:
      None
    • Environment:

      Linux

      Description

      Improper rollback happening in case of user transactions inside callable task when submitted to ManagedExecutorService object, which is created using Command:
      ./asadmin create-managed-executor-service --corepoolsize 1 --maximumpoolsize 2 concurrent/mes , but giving right/expected result when using __defaultManagedExecutorService object.

      Output:
      Obtained output for concurrent/mes created using cli is that task 3, 4, 5, 7, 9 was committed while correct task id to be committed are 1,3,5,7,9 i.e. every odd id.

      callable task contains:
      ut = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
      ut.begin();
      Connection con = getJNDIConnection();
      Logger.getLogger("ReporterTask").log(Level.INFO, Thread.currentThread().getName() + " ::TransactionReport Task-" + id + " started transaction at " + System.currentTimeMillis() + " msec. ");
      addIdToTableInJavaDB(con); //ADDS Id and threadname to the table in the database using datasource
      Thread.sleep(5000);
      con.close();

      if(id%2==0)

      { ut.setRollbackOnly(); //i.e every alternate task submitted is rolleback and should not commit in database. }


      ut.commit();

      and task is submitted as:
      for (int i = 0; i < 10; i++) {
      Future reportFuture = mses.submit(new callableTask);
      }

      addIdToTableInJavaDB(con): This function uses dataSource as shown below to write to database.

      result = datasource.getConnection();
      statement.executeUpdate("INSERT INTO PAIR VALUES.......... ");

      Please mail me if you want any other information to reproduce the bug.

        Activity

        Hide
        anthony.lai added a comment -

        Requesting test case from filer.

        Show
        anthony.lai added a comment - Requesting test case from filer.
        Hide
        anthony.lai added a comment -

        glassfish~svn:60037

        Show
        anthony.lai added a comment - glassfish~svn:60037

          People

          • Assignee:
            anthony.lai
            Reporter:
            shobhit.singh
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: