Skip to content

Scoped Dependency Issue #156

@anthony-keller

Description

@anthony-keller

This issue may prove tricky to repro, so I'll explain the issue and you can advise on further action.

This image shows some logs containing the HttpContext TraceIdentifier, the DbContext Id and a Guid in a scoped dependency RequestAuthVariables.

image

The highlighted rows show that two different HttpContexts get the same instance of RequestAuthVariables.

This is an intermittent issue in our production system and we've been able to reproduce in an integration test using a Parallel.ForEachAsync loop of 100. A loop of 10 typically works correctly and even the loop of 100 occasionally works.

Our interim solution is to register our triggers as Transient instead of Scoped.

We're using the AddTriggeredDbContextPool and AddTriggeredPooledDbContextFactory

@benmccallum and I are happy to try and work with you as needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededwontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions