Bug #2580

Race condition in LocalMethod: handler called before activation is finished

Added by M. Pohling almost 8 years ago. Updated almost 8 years ago.

Status:ResolvedStart date:06/22/2016
Priority:NormalDue date:
Assignee:J. Wienke% Done:

100%

Category:Java
Target version:rsb-0.13

Description

Sometimes (1 of 20 test-runs) we get this internal rsb exception.

Exception in thread "Thread-6751" java.lang.IllegalStateException: send(Event) cannot be called in state StateInactive
 19     at rsb.Informer$State.send(Informer.java:89)
 20     at rsb.Informer.publish(Informer.java:306)
 21     at rsb.patterns.LocalMethod.internalNotify(LocalMethod.java:128)
 22     at rsb.eventprocessing.SingleThreadEventReceivingStrategy$DispatchThread.run(SingleThreadEventReceivingStrategy.java:98) 

The informer seems to be not initialized but the internalNotify method does not check the isActive state.
After this exception occurs rsb events get lost. Seems that any internal handler thread is killed afterwards.

Associated revisions

Revision ceef4308
Added by J. Wienke almost 8 years ago

Change order listener and informer activation in Method

This change shall ensure that for LocalMethods the informer is always
ready, even if the main activation hasn't completed, because the
Listener might start to receive requests in this moment.

This might be an explanation for refs #2580, but seems quite unlikely.

Revision 024ebfb3
Added by J. Wienke almost 8 years ago

Proper fix for #2580

Ensure that LocalMethod handlers are not called before the reply
informer is set up.

fixes #2580

Revision 738f6cd6
Added by J. Wienke almost 8 years ago

Proper fix for #2580

Ensure that LocalMethod handlers are not called before the reply
informer is set up.

fixes #2580

(cherry picked from commit 024ebfb31d4642d5e3ec9bf610e2596845be8637)

Revision 66de8c5a
Added by J. Wienke almost 8 years ago

Proper fix for #2580

Ensure that LocalMethod handlers are not called before the reply
informer is set up.

fixes #2580

(cherry picked from commit 024ebfb31d4642d5e3ec9bf610e2596845be8637)

History

#1 Updated by J. Wienke almost 8 years ago

  • Subject changed from internalNotify results in IllegalStateException in some cases to Race condition in LocalMethod: handler called before activation is finished
  • Status changed from New to In Progress
  • Assignee set to J. Wienke

The handler of the listener is registered before the informer is activated and the activate method has finished. Therefore the method might be called before it can actually send replies.

#2 Updated by J. Wienke almost 8 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF