EntityFrameworkCore.Triggered icon indicating copy to clipboard operation
EntityFrameworkCore.Triggered copied to clipboard

Scoped Dependency Issue

Open anthony-keller opened this issue 3 years ago • 3 comments

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.

anthony-keller avatar Aug 12 '22 05:08 anthony-keller

@anthony-keller Haven't had a chance to look into this yet, will have more time in the coming weeks. If you have a repro, that would be super useful! I tried to recreate this issue once without success.

koenbeuk avatar Sep 06 '22 19:09 koenbeuk

@koenbeuk I can repro in our codebase so perhaps at some point we could jump on a Zoom/Meet/Teams to debug. I'm in GMT+10:00

anthony-keller avatar Sep 06 '22 22:09 anthony-keller

@anthony-keller Happy to do so, please sent me a ping at ~~redacted~~ so that we can arrange a time and virtual place. Thanks!

koenbeuk avatar Sep 06 '22 22:09 koenbeuk

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 06 '22 14:11 stale[bot]

We found a memory leak issue in #168 that may have caused this issue. We should test if this is still an issue after updating to v3.2.2

koenbeuk avatar Dec 11 '22 23:12 koenbeuk

I did report a potential regression on the pr about 30 mins ago

anthony-keller avatar Dec 12 '22 00:12 anthony-keller

I'll test this issue as well

anthony-keller avatar Dec 12 '22 00:12 anthony-keller

I'm still table to reproduce this issue on 3.2.2.

anthony-keller avatar Dec 12 '22 06:12 anthony-keller

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 10 '23 10:02 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 18 '23 03:04 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 17 '23 17:06 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 18 '23 16:08 stale[bot]