Skip to content

Cache Concurrency Guard (Associations) #128

Description

@JeremyCaney

A follow-up to #117: When two web requests try to resolve the same topic's relationships or references at the same time, both attempt to wire up the results to the same shared in-memory topic, including the other topic's IncomingRelationships list, which can corrupt that shared state or throw an exception. This closes that race with a lock, scoped narrowly enough to avoid deadlocking on the batch-load work (e.g., #127).

Tasks

  • Add a unit test that triggers the race (i.e., two concurrent reads resolving the same relationships)
  • Wrap the wire-up steps in CachedTopicRepository under the existing cache-wide lock
    • The batch-load step itself stays unlocked, since locking it could deadlock for bidirectional references
  • Confirm un-cached repositories (TopicRepository, SqlTopicRepository) are unaffected (they shouldn't be)
  • Create unit tests to validate the above logic

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Area: EntityRelates to the core data data structure for modeling topic entities.Area: RepositoriesRelates to the `ITopicRepository` interface or one of its implementations.Priority: 1Severity 2: MajorStatus 2: ScheduledPlanned for an upcoming release.Type: BugBehavior that is inconsistent with documented or expected behavior.Type: ImprovementImproves the functionality or interface of an existing feature.

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions