Skip to content

Possible issue in SimpleQueueCacheCursor.RecordDeliveryFailure #6298

@KevinCathcart

Description

@KevinCathcart

I'm looking at the code for SimpleQueueCacheCursor.RecordDeliveryFailure(). That code is called by the PersistentStreamPullingAgent when the current value retrieved from the cursor could not be delivered. The function looks like this:

/// <summary>
/// Record that delivery of the current event has failed
/// </summary>
public void RecordDeliveryFailure()
{
if (IsSet && current != null)
{
Element.Value.DeliveryFailure = true;
}
}

The confusing thing is that Element is documented as pointing to the next element after current. So it would seem like the DeliveryFailure flag is being set on the element after the one that failed. Which might not be much of a problem as long as such an element always exists, and the code that consumes consumes this flag looks ahead (but that would certainly warrant a comment). However there is not always a next item, and it looks like the code that consumes this (SimpleQueueCacheItem.DrainBucket) does not look ahead.

So am I missing something, or is this buggy?

If this is buggy, fixing this directly seems tricky, because the value in the cursor's current field may no longer even be in the cache, since it could be in the previous cache bucket relative to Element, and therefore would be eligible for cleanup.

Metadata

Metadata

Assignees

Labels

staleIssues with no activity for the past 6 months

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions