[ 
https://issues.apache.org/jira/browse/AMQNET-727?focusedWorklogId=913036&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-913036
 ]

ASF GitHub Bot logged work on AMQNET-727:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Apr/24 14:45
            Start Date: 04/Apr/24 14:45
    Worklog Time Spent: 10m 
      Work Description: AndyDeMauriceGEDigital opened a new pull request, #34:
URL: https://github.com/apache/activemq-nms-openwire/pull/34

   Fix for the thread sync issues as reported in AMQNET-727.
   Note that the first part of the fix (in DeliverAcks), comes from this fix in 
the Java client:
   
https://github.com/apache/activemq/commit/c02bc648460059b6dbc201fa21b7ee0ce2445082
   
   The 2nd part of the fix (in AfterMessageIsConsumedAsync), is just a slight 
change to make the call to AckLaterAsync occur while the lock is held.




Issue Time Tracking
-------------------

            Worklog Id:     (was: 913036)
    Remaining Estimate: 0h
            Time Spent: 10m

> Thread sync error with MessageConsumer.pendingAck
> -------------------------------------------------
>
>                 Key: AMQNET-727
>                 URL: https://issues.apache.org/jira/browse/AMQNET-727
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: OpenWire
>    Affects Versions: 1.8.0
>            Reporter: Andy DeMaurice
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> pendingAck is accessed by multiple threads; in most places where it is 
> written, it is done along with accessing *deliveredMessages*, so it is 
> written within a *lock(this.deliveredMessages)* block.
> However, this call stack shows where pendingAck gets assigned to a new 
> MessageAck object, NOT within the lock... and it is subject to being 
> overwritten by another thread (usually the other thread is in 
> MessageConsumer.Acknowledge() :
>  
> Apache.NMS.ActiveMQ.MessageConsumer.AckLater(Apache.NMS.ActiveMQ.Commands.MessageDispatch,
>  Apache.NMS.ActiveMQ.AckType)
> Apache.NMS.ActiveMQ.MessageConsumer.AfterMessageIsConsumed(Apache.NMS.ActiveMQ.Commands.MessageDispatch,
>  Boolean)
> Apache.NMS.ActiveMQ.MessageConsumer.Dispatch(Apache.NMS.ActiveMQ.Commands.MessageDispatch)
> Apache.NMS.ActiveMQ.SessionExecutor.Dispatch(Apache.NMS.ActiveMQ.Commands.MessageDispatch)
> Apache.NMS.ActiveMQ.SessionExecutor.Iterate()
> Apache.NMS.ActiveMQ.Threads.DedicatedTaskRunner.Run()
>  
> The usual symptom I see is a NullReferenceException in this section of code 
> within AckLater; because pendingAck has been set to null by another thread:
>  
> if(oldPendingAck == null)
>  {
>    pendingAck.FirstMessageId = pendingAck.LastMessageId;
>  }
>  else if(oldPendingAck.AckType == pendingAck.AckType)
>  {
>    pendingAck.FirstMessageId = oldPendingAck.FirstMessageId;
>  }



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to