-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
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:
orleans/src/OrleansProviders/Streams/Common/SimpleCache/SimpleQueueCacheCursor.cs
Lines 111 to 120 in 7090d7d
| /// <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.