You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Krzysztof Porębski (Jira)" <ji...@apache.org> on 2025/11/23 23:41:00 UTC

[jira] [Resolved] (AMQNET-727) Thread sync error with MessageConsumer.pendingAck

     [ https://issues.apache.org/jira/browse/AMQNET-727?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Krzysztof Porębski resolved AMQNET-727.
---------------------------------------
    Resolution: Fixed

> 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
>             Fix For: OpenWire-2.1.1
>
>          Time Spent: 1.5h
>  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)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@activemq.apache.org
For additional commands, e-mail: issues-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact