Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-4410

Task status doesn't rollback if exception is thrown from taskService.start() when executing TaskServiceEntryPointImpl#claimBatch()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • jBPM 6.1.0.CR1
    • Human Task Service
    • Hide

      There should be other more simple / general ways to reproduce the issue, but I'll just use the reproducer from a customer support case.

      In this case a custom UserGroupCallback is implemented. The custom UserGroupCallback returns inconsistent user/group data intentionally (gives 'false' when checking user existence, but gives some group ids when retrieve user group info.)

      So the user can see the task and can click the 'claim' button, but while executing taskService.start(), it gives this error:

      17:19:30,454 WARN [org.jbpm.services.task.persistence.TaskTransactionInterceptor] (http-localhost-127.0.0.1-8080-1) Could not commit session: org.jbpm.services.task.exception.PermissionDeniedException: User 'null' does not have permissions to execute operation 'Start' on task id 6

      Testing steps:

      1) install jBPM 6.1.0CR1, "ant install.demo"

      2) unzip /jboss-as-7.1.1.Final/standalone/deployments/jbpm-console.war and remove this .war file, use exploded folder "jbpm-console.war" to deploy

      3) copy "custom-user-group-callback.jar" to /jbpm-console.war/WEB-INF/lib and update "jbpm-console.war/WEB-INF/beans.xml" file:
      <alternatives><class>com.test.services.producer.CustomTestUserGroupInfoProducer</class>
      </alternatives>

      4) start JBoss "ant start.demo.noeclipse", and login into jbpm-console as "admin"

      5) use the demo "HR" project, build&deploy it, start a "Hiring a Developer" process instance

      6) log out and switch to HR user "mary", check task list, a task should be there, then claim it, everything is fine, change to "In Progress" status.
      But if use "katy" user to claim it here, following log will be printed out and the task goes to "Reserved" status. ("Ready" is expected)

      17:19:30,454 WARN [org.jbpm.services.task.persistence.TaskTransactionInterceptor] (http-localhost-127.0.0.1-8080-1) Could not commit session: org.jbpm.services.task.exception.PermissionDeniedException: User 'null' does not have permissions to execute operation 'Start' on task id 6
      at org.jbpm.services.task.internals.lifecycle.MVELLifeCycleManager.evalCommand(MVELLifeCycleManager.java:100) [jbpm-human-task-core-6.1.0.CR1.jar:6.1.0.CR1]
      at org.jbpm.services.task.internals.lifecycle.MVELLifeCycleManager.taskOperation(MVELLifeCycleManager.java:337) [jbpm-human-task-core-6.1.0.CR1.jar:6.1.0.CR1]
      at org.jbpm.services.task.identity.UserGroupLifeCycleManagerDecorator.taskOperation(UserGroupLifeCycleManagerDecorator.java:48) [jbpm-human-task-core-6.1.0.CR1.jar:6.1.0.CR1]
      at org.jbpm.services.task.impl.TaskInstanceServiceImpl.start(TaskInstanceServiceImpl.java:201) [jbpm-human-task-core-6.1.0.CR1.jar:6.1.0.CR1]
      at org.jbpm.services.task.commands.StartTaskCommand.execute(StartTaskCommand.java:48) [jbpm-human-task-core-6.1.0.CR1.jar:6.1.0.CR1]
      at org.jbpm.services.task.commands.StartTaskCommand.execute(StartTaskCommand.java:30) [jbpm-human-task-core-6.1.0.CR1.jar:6.1.0.CR1]
      at org.jbpm.services.task.commands.CompositeCommand.execute(CompositeCommand.java:38) [jbpm-human-task-core-6.1.0.CR1.jar:6.1.0.CR1]
      at org.jbpm.services.task.commands.TaskCommandExecutorImpl$SelfExecutionCommandService.execute(TaskCommandExecutorImpl.java:65) [jbpm-human-task-core-6.1.0.CR1.jar:6.1.0.CR1]

      Show
      There should be other more simple / general ways to reproduce the issue, but I'll just use the reproducer from a customer support case. In this case a custom UserGroupCallback is implemented. The custom UserGroupCallback returns inconsistent user/group data intentionally (gives 'false' when checking user existence, but gives some group ids when retrieve user group info.) So the user can see the task and can click the 'claim' button, but while executing taskService.start(), it gives this error: 17:19:30,454 WARN [org.jbpm.services.task.persistence.TaskTransactionInterceptor] (http-localhost-127.0.0.1-8080-1) Could not commit session: org.jbpm.services.task.exception.PermissionDeniedException: User 'null' does not have permissions to execute operation 'Start' on task id 6 Testing steps: 1) install jBPM 6.1.0CR1, "ant install.demo" 2) unzip /jboss-as-7.1.1.Final/standalone/deployments/jbpm-console.war and remove this .war file, use exploded folder "jbpm-console.war" to deploy 3) copy "custom-user-group-callback.jar" to /jbpm-console.war/WEB-INF/lib and update "jbpm-console.war/WEB-INF/beans.xml" file: <alternatives><class>com.test.services.producer.CustomTestUserGroupInfoProducer</class> </alternatives> 4) start JBoss "ant start.demo.noeclipse", and login into jbpm-console as "admin" 5) use the demo "HR" project, build&deploy it, start a "Hiring a Developer" process instance 6) log out and switch to HR user "mary", check task list, a task should be there, then claim it, everything is fine, change to "In Progress" status. But if use "katy" user to claim it here, following log will be printed out and the task goes to "Reserved" status. ("Ready" is expected) 17:19:30,454 WARN [org.jbpm.services.task.persistence.TaskTransactionInterceptor] (http-localhost-127.0.0.1-8080-1) Could not commit session: org.jbpm.services.task.exception.PermissionDeniedException: User 'null' does not have permissions to execute operation 'Start' on task id 6 at org.jbpm.services.task.internals.lifecycle.MVELLifeCycleManager.evalCommand(MVELLifeCycleManager.java:100) [jbpm-human-task-core-6.1.0.CR1.jar:6.1.0.CR1] at org.jbpm.services.task.internals.lifecycle.MVELLifeCycleManager.taskOperation(MVELLifeCycleManager.java:337) [jbpm-human-task-core-6.1.0.CR1.jar:6.1.0.CR1] at org.jbpm.services.task.identity.UserGroupLifeCycleManagerDecorator.taskOperation(UserGroupLifeCycleManagerDecorator.java:48) [jbpm-human-task-core-6.1.0.CR1.jar:6.1.0.CR1] at org.jbpm.services.task.impl.TaskInstanceServiceImpl.start(TaskInstanceServiceImpl.java:201) [jbpm-human-task-core-6.1.0.CR1.jar:6.1.0.CR1] at org.jbpm.services.task.commands.StartTaskCommand.execute(StartTaskCommand.java:48) [jbpm-human-task-core-6.1.0.CR1.jar:6.1.0.CR1] at org.jbpm.services.task.commands.StartTaskCommand.execute(StartTaskCommand.java:30) [jbpm-human-task-core-6.1.0.CR1.jar:6.1.0.CR1] at org.jbpm.services.task.commands.CompositeCommand.execute(CompositeCommand.java:38) [jbpm-human-task-core-6.1.0.CR1.jar:6.1.0.CR1] at org.jbpm.services.task.commands.TaskCommandExecutorImpl$SelfExecutionCommandService.execute(TaskCommandExecutorImpl.java:65) [jbpm-human-task-core-6.1.0.CR1.jar:6.1.0.CR1]

    Description

      When a group member claims a taks in business-central, TaskServiceEntryPointImpl#claimBatch() is executed:

      public void claimBatch(List<Long> taskIds, String user) {
      for (Long taskId : taskIds)

      { taskService.claim(taskId, user); taskService.start(taskId, user); }

      }

      After taskService.claim(taskId, user), the task status changes to "Reserved".
      And if an exception is thrown in taskService.start(taskId, user) , the task status will not be changed back to "Ready" (it will stay "Reserved")

      In my testing scenario, the exception thrown from taskService.start() is: org.jbpm.services.task.exception.PermissionDeniedException

      Attachments

        Activity

          People

            salaboy@gmail.com Mauricio Salatino (Inactive)
            rhn-support-lywang Lyle Wang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: