[jboss-jira] [JBoss JIRA] Commented: (JGRP-934) NAKACK/UNICAST: atomic boolean vars might lead to message not getting processed immediately

Bela Ban (JIRA) jira-events at lists.jboss.org
Wed Mar 18 13:12:24 EDT 2009


    [ https://jira.jboss.org/jira/browse/JGRP-934?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12457994#action_12457994 ] 

Bela Ban commented on JGRP-934:
-------------------------------

Actually, not true !!!

The NakReceiverWindow.remove(processing) method removes a message and set 'processing' to false if msg == null *atomically* with respect to NakReceiverWindow.add().

Therefore we have the atomic blocks

[ T1 adds message M1 and checks 'processing'] and

[T2 removes a message msg
  If msg is null --> sets 'processing' to false
  If msg is not null --> continue and remove next message]

If block 1 comes first and then block2 (remove() is blocked until add() is done):
- Block 2 will 'see' M1 and remove and process it, T1 will terminate

If block 2 comes first and then block 1 (add() is blocked by remove()):
- T2 terminates and processing is false
- T1 can set processing to true and removes M1 and processes it





> NAKACK/UNICAST: atomic boolean vars might lead to message not getting processed immediately
> -------------------------------------------------------------------------------------------
>
>                 Key: JGRP-934
>                 URL: https://jira.jboss.org/jira/browse/JGRP-934
>             Project: JGroups
>          Issue Type: Bug
>            Reporter: Bela Ban
>            Assignee: Bela Ban
>            Priority: Minor
>             Fix For: 2.9
>
>
> When we have a thread T1 adding a message and T2 removing them, the following situation might occur:
> - T2 removes a null message
> - T2 terminates remove loop
> - T1 adds message M1 and tries to set the atomic var to true, result is false
> - T2 sets the atomic boolean var from true to false
> - T1 returns
> - T2 returns
> ==> M1 is not getting processed until the next thread dlivers a message !
> This is a very rare case, but still needs to be fixed, maybe with 2 overlapping atomic vars ?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list