Bug 834673

Summary: JBPM-3688: Human Task dying issues
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Lukáš Petrovický <lpetrovi>
Component: jBPM 5Assignee: Kris Verlaenen <kverlaen>
Status: VERIFIED --- QA Contact: Marek Baluch <mbaluch>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: BRMS 5.3.0.GA   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
In instances where an incorrect request was issued to the human task server, the incorrect request would result in a runtime exception that caused the human task server to die, which meant no more requests could be processed. This has been resolved by ensuring the human task server is not affected by runtime exceptions, and the process requests continue in the human task server.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lukáš Petrovický 2012-06-22 18:25:26 UTC
Please backport to BRMS 5.3 branch after we've got the proper ACKs.

Comment 1 JBoss JIRA Server 2012-07-03 08:16:24 UTC
Marco Rietveld <marco.rietveld> made a comment on jira JBPM-3688

Maciej, I thought I saw a commit which fixed the incorrect command name/class -- did you fix that already? 

Also, re return runtime exceptions -- well, 2 things: 

# log them, and 
# make sure that if the thread really does have to die, that it dies as follows: 
a. in a way that leaves some sort of state behind, so that it's possible to "restart" the thread or have the work it was doing be recovered. 
b. in a controlled way, instead of just dying because of an exception. 

2a. might be overengineering, any thoughts on that?

Comment 2 JBoss JIRA Server 2012-07-03 09:18:35 UTC
Maciej Swiderski <swiderski.maciej> updated the status of jira JBPM-3688 to Open

Comment 3 Maciej Swiderski 2012-07-03 09:26:16 UTC
Correct, it was fixed on master with this commit: https://github.com/droolsjbpm/jbpm/commit/b584699cd7afc7338528cd774df3fd5617a3b729

In general, incorrect command name was fixed for getTaskByWorkItemId so no more CCE is thrown in case of server side exception.

Regarding threads management, there are few improvements:
- server side - thread should "die" only if consumer attached to it is no longer active - so the change in the thread loop to continue as long as consumer is not closed, besides that all exceptions are logged and nothing is rethrown

- client side - for receiver side, it relies on the same rule as server - as long as consumer is active the thread will be active as well, in addition it has capability to reconnect in case object close exception is thrown by hornetq for both sender and receiver side, moreover when sending operation will be retried if reconnect succeeds

Is this what you had in mind?

Comment 4 Marco Rietveld 2012-07-03 10:07:28 UTC
After talking with Maciej, I realized that part of the problem is that there are a couple places in the persistence logic where

1. There's not enough input checking and/or
2. The query logic expects 1 result _or_ a list of results, but gets the opposite from what it expected. Unfortunately, in this case, the Java (JPA) code isn't built to handle this and it ends in exceptions (see JBPM-3688 for an example, actually). 

This means that we need to: 

A. add more input checking to the persistence methods -- although I'm not sure how to handle situations in which the input is "wrong". 
B. Add more exception handling to the JPA query Java code so that unexpected results to a query don't crash a thread. 

To some extent, these principles apply to all of the HT code -- although I think the rest of the code is a lot more robust than this particular part.

Comment 5 JBoss JIRA Server 2012-08-15 18:20:04 UTC
Maciej Swiderski <swiderski.maciej> made a comment on jira JBPM-3688

one more commit to avoid infinite retries in case of broken connection to task server: https://github.com/droolsjbpm/jbpm/commit/e302939576aa4f9fc6c0695d0824c8948a9ca1b1

Comment 6 Mauricio Salatino 2012-08-21 22:00:34 UTC
So, Maciej, is this ported back to 5.2? can we change the status of the issue? or the assignee?

Comment 7 Maciej Swiderski 2012-08-22 08:35:23 UTC
it is not yet backported, will take care of it

Comment 8 Maciej Swiderski 2012-08-23 15:34:24 UTC
backported into 5.2.x branch

Comment 9 JBoss JIRA Server 2012-09-28 13:05:59 UTC
Maciej Swiderski <swiderski.maciej> updated the status of jira JBPM-3688 to Resolved

Comment 10 Jiri Svitak 2012-10-11 09:56:54 UTC
Verified in BRMS 5.3.1 ER3.

Comment 11 Douglas Hoffman 2012-10-22 02:57:52 UTC
Based on the Doc Text information you have provided, I have updated the text for Release Notes purposes. Many thanks for this information. 

- Doug