Repository navigation
Conversation
DeadlockProof_CrossFeedingSubscriptions failed intermittently in CI (PR #1207, PR #1103 and two Renovate runs) by exceeding its 30 second WhenAny guard. Nothing deadlocked: the writers were Task.Run threads meeting at a Barrier, so on an oversubscribed runner, during the parallel phase of the test run, a starved thread pool left one writer unstarted and the other parked at the Barrier. The same failure reproduces locally on unmodified main by running the parallel tests on one core with DOTNET_PROCESSOR_COUNT=8. The test also did not guard what it claimed. Its writes crossed only the source caches, whose delivery queue lets a second writer enqueue and return, so it still passed with CacheParentSubscription holding its gate while delivering. The replacement parks each writer inside its own subscription's delivery until the other is there too, then feeds the other subscription through its child observable and its source cache. Holding a lock while delivering, in either the subscription or the cache, now deadlocks on every run; both were confirmed by mutation. Writers run on dedicated threads, the test lives in the non-parallel IntegrationTests collection, a Timeout attribute bounds a hang, and the assertions check the exact contents of both caches and both observers.
…l collection InlineDeliveryDoesNotLetLaterNotificationsJumpTheQueue failed intermittently in CI (five Renovate runs) and locally under the same oversubscription that reproduces the cross-feeding CacheParentSubscription failure, by exceeding its Timeout. The four tests that park a delivery start their drainer with Task.Run and resume through RunContinuationsAsynchronously, so they wait on the thread pool, and xUnit v2 only supports Timeout in a collection with parallelization disabled. Move them, unchanged apart from indentation, into a nested IntegrationTests class, and start the drainer on a thread of its own.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CacheParentSubscriptionFixture.DeadlockProof_CrossFeedingSubscriptionsfails intermittently in CI, unrelated to the PRs it fails on (#1207, #1103 and several Renovate runs). It is a flaky test, not a deadlock in the library.Root cause
Task.Runthreads meeting at aBarrier(2), guarded by a 30 sTask.WhenAny/Task.Delay.main: run the parallel-phase tests on one core (start /affinity 0x1) withDOTNET_PROCESSOR_COUNT=8. The test passes in about 45 ms on its own.ObservableCache(DeliveryQueue) andCacheParentSubscription(SharedDeliveryQueue) release their lock before delivering.CacheParentSubscriptionheld its gate during delivery.SharedDeliveryQueueFixture.InlineDeliveryDoesNotLetLaterNotificationsJumpTheQueuefails the same way (5 CI runs, and alongside this test in the local repro). Its drainer is aTask.Runthread, its continuations need the pool, and xUnit v2 only supportsTimeoutwhen parallelization is disabled.Changes
DeadlockProof_CrossFeedingSubscriptionsis replaced byCacheParentSubscriptionFixture.IntegrationTests.CrossFeedingSubscriptions_FeedEachOtherDuringDelivery_DoNotDeadlock:TaskCreationOptions.LongRunning).IntegrationTestscollection. A hang is bounded only by[Fact(Timeout = 10_000)], with noWhenAny,Delay,Sleepor polling.SharedDeliveryQueueFixturetests move, unchanged apart from indentation, into a nestedIntegrationTestsclass, and their drainer runs on a dedicated thread.Test-only change: no library code or public API is affected.
Validation
mainfail 2 of 3.