Bug 869012 - LocalTaskService don't remove listeners
LocalTaskService don't remove listeners
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: jBPM 5 (Show other bugs)
BRMS 5.3.0.GA
Unspecified Unspecified
unspecified Severity unspecified
: ER4
: BRMS 5.3.1 GA
Assigned To: Maciej Swiderski
Marek Winkler
Depends On:
  Show dependency treegraph
Reported: 2012-10-22 14:33 EDT by Alessandro Lazarotti
Modified: 2013-10-10 20:07 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Event listeners that were registered on Human Task work item handler at initialization, were not removed on disposal of the handler and stayed active and receiving events. This caused unexpected exceptions to be thrown when completing tasks after the knowledge session disposal. This has been resolved by ensuring that event listeners are removed on handler disposal so that only active event listeners are receiving events from the human task server.
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker JBPM-3578 Major Resolved LocalTaskService don't remove listeners 2013-07-10 09:46:28 EDT

  None (edit)
Description Alessandro Lazarotti 2012-10-22 14:33:02 EDT
LocalTaskService don't remove the listeners that are created in:

  public void registerForEvent(EventKey key, boolean remove, EventResponseHandler responseHandler) {
    SimpleEventTransport transport =
        new SimpleEventTransport(taskServiceSession, responseHandler, remove);
    taskServiceSession.getService().getEventKeys().register(key, transport);

Notice that a client of this method can't remove it later, becouse the method return void.

This method is called by SyncWSHumanTaskHandler.connect()

 private void registerTaskEvents() {
 TaskCompletedHandler eventResponseHandler = new TaskCompletedHandler();
        TaskEventKey key = new TaskEventKey(TaskCompletedEvent.class, -1);
        client.registerForEvent(key, false, eventResponseHandler);
        key = new TaskEventKey(TaskFailedEvent.class, -1);
        client.registerForEvent(key, false, eventResponseHandler);
        key = new TaskEventKey(TaskSkippedEvent.class, -1);
        client.registerForEvent(key, false, eventResponseHandler);

See that the listeners aren't save to remove later. If don't remove the listeners, they are invoked later.

PS: This can generate "Illegal method call. This session was previously disposed" - when a task is to be completed.
Comment 2 Maciej Swiderski 2012-10-24 13:52:56 EDT
fix backported to branch 5.2.x
Comment 3 lcarlon 2012-10-25 19:38:32 EDT
This issue has been marked as requires_doc_text, however, no text has been provided. Please provide the text so it can be added to the release notes document, or set the requires_doc_text flag to '-'.

Comment 4 lcarlon 2012-11-05 00:31:01 EST
Hi Maciej,

Thanks for providing the doc text. I've edited it for the release notes document. Do you mind taking a quick look to make sure I didn't garble the meaning in the edit.

Comment 5 Maciej Swiderski 2012-11-05 00:40:58 EST
Lee, it's perfect
Comment 6 Marek Winkler 2012-11-13 11:23:05 EST
Verified on 5.3.1.BRMS-ER4.
Comment 7 Tim Schade 2013-06-20 09:09:06 EDT
we encounter this issue in version 5.4.0.FINAL.

Is the fix included in this version?

Note You need to log in before you can comment on or make changes to this bug.