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

2024-05-13 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on AMQNET-727:
-

Author: ASF GitHub Bot
Created on: 13/May/24 21:28
Start Date: 13/May/24 21:28
Worklog Time Spent: 10m 
  Work Description: Havret merged PR #37:
URL: https://github.com/apache/activemq-nms-openwire/pull/37




Issue Time Tracking
---

Worklog Id: (was: 919198)
Time Spent: 1.5h  (was: 1h 20m)

> 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: 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)


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

2024-05-13 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on AMQNET-727:
-

Author: ASF GitHub Bot
Created on: 13/May/24 11:58
Start Date: 13/May/24 11:58
Worklog Time Spent: 10m 
  Work Description: AndyDeMauriceGEDigital commented on code in PR #37:
URL: 
https://github.com/apache/activemq-nms-openwire/pull/37#discussion_r1598352251


##
src/MessageConsumer.cs:
##
@@ -1251,15 +1251,11 @@ public virtual async Task 
AfterMessageIsConsumedAsync(MessageDispatch dispatch,
 }
 else if(IsClientAcknowledge || IsIndividualAcknowledge)
 {
-bool messageAckedByConsumer = false;
 
 using(await this.deliveredMessagesLock.LockAsync().Await())
 {
-messageAckedByConsumer = 
this.deliveredMessages.Contains(dispatch);
-}
+if (this.deliveredMessages.Contains(dispatch))

Review Comment:
   fixed





Issue Time Tracking
---

Worklog Id: (was: 919070)
Time Spent: 1h 20m  (was: 1h 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: 1h 20m
>  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)


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

2024-05-12 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on AMQNET-727:
-

Author: ASF GitHub Bot
Created on: 12/May/24 21:54
Start Date: 12/May/24 21:54
Worklog Time Spent: 10m 
  Work Description: Havret commented on code in PR #37:
URL: 
https://github.com/apache/activemq-nms-openwire/pull/37#discussion_r1597722159


##
src/MessageConsumer.cs:
##
@@ -1251,15 +1251,11 @@ public virtual async Task 
AfterMessageIsConsumedAsync(MessageDispatch dispatch,
 }
 else if(IsClientAcknowledge || IsIndividualAcknowledge)
 {
-bool messageAckedByConsumer = false;
 
 using(await this.deliveredMessagesLock.LockAsync().Await())
 {
-messageAckedByConsumer = 
this.deliveredMessages.Contains(dispatch);
-}
+if (this.deliveredMessages.Contains(dispatch))

Review Comment:
   There is something messed up with the indentation here. Please add the 
parentheses right below the 'if' so the intention is clear.





Issue Time Tracking
---

Worklog Id: (was: 918983)
Time Spent: 1h 10m  (was: 1h)

> 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: 1h 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)


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

2024-05-04 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on AMQNET-727:
-

Author: ASF GitHub Bot
Created on: 04/May/24 11:52
Start Date: 04/May/24 11:52
Worklog Time Spent: 10m 
  Work Description: AndyDeMauriceGEDigital commented on PR #37:
URL: 
https://github.com/apache/activemq-nms-openwire/pull/37#issuecomment-2094135906

   @chirino Can you please review this change?




Issue Time Tracking
---

Worklog Id: (was: 917623)
Time Spent: 1h  (was: 50m)

> 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: 1h
>  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)


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

2024-04-17 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on AMQNET-727:
-

Author: ASF GitHub Bot
Created on: 17/Apr/24 13:26
Start Date: 17/Apr/24 13:26
Worklog Time Spent: 10m 
  Work Description: AndyDeMauriceGEDigital commented on PR #37:
URL: 
https://github.com/apache/activemq-nms-openwire/pull/37#issuecomment-2061260927

   @Havret  Can you please review this change?




Issue Time Tracking
---

Worklog Id: (was: 915120)
Time Spent: 50m  (was: 40m)

> 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: 50m
>  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)


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

2024-04-13 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on AMQNET-727:
-

Author: ASF GitHub Bot
Created on: 13/Apr/24 13:27
Start Date: 13/Apr/24 13:27
Worklog Time Spent: 10m 
  Work Description: AndyDeMauriceGEDigital commented on PR #34:
URL: 
https://github.com/apache/activemq-nms-openwire/pull/34#issuecomment-2053646553

   Replace with https://github.com/apache/activemq-nms-openwire/pull/37




Issue Time Tracking
---

Worklog Id: (was: 914497)
Time Spent: 40m  (was: 0.5h)

> 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: 40m
>  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)


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

2024-04-13 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on AMQNET-727:
-

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

   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: 914496)
Time Spent: 0.5h  (was: 20m)

> 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: 0.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)


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

2024-04-13 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on AMQNET-727:
-

Author: ASF GitHub Bot
Created on: 13/Apr/24 13:19
Start Date: 13/Apr/24 13:19
Worklog Time Spent: 10m 
  Work Description: AndyDeMauriceGEDigital closed pull request #34: Fix for 
AMQNET-727
URL: https://github.com/apache/activemq-nms-openwire/pull/34




Issue Time Tracking
---

Worklog Id: (was: 914495)
Time Spent: 20m  (was: 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: 20m
>  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)


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

2024-04-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/AMQNET-727?focusedWorklogId=913036=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)