autofac / Autofac.Owin

OWIN integration for Autofac
MIT License
23 stars 15 forks source link

7.0.0 introduced memory leak due to async disposal issue in main Autofac #34

Closed srogovtsev closed 1 year ago

srogovtsev commented 1 year ago

I want to file this here just so that the people Googling for the symptoms will be able to find it and see the resolution

Describe the Bug

After upgrading to Autofac.Owin 7.0.0 we've observed a sizeable memory leak due to a lot of held System.Threading.ThreadLocal+LinkedSlotVolatile<System.Collections.Concurrent.ConcurrentBag+ThreadLocalList<Autofac.Core.IComponentRegistration>>

Steps to Reproduce

Expected Behavior

Dependency Versions

Autofac: 6.4.0 Autofac.Owin: 7.0.0

Additional Info

So, to fix this, we simply need to wait for new core release, and then simply bump the required dependency version.

tillig commented 1 year ago

@alistairjevans Do you think we're ready for a 6.5.0 release on core Autofac? I vaguely recall you were trying to get some more of the cache fixup work done but it may be at a point where it's stable enough to get out what's there.

alistairjevans commented 1 year ago

Yeah, it may have to go out without the isolated scope changes (no harm doing so really); I'd been hoping to get back to them sooner, but have been absolutely slammed at the day job.

tillig commented 1 year ago

Just to verify - some of the changes to support that did get merged in even if the whole feature isn't complete. I just wanted to make sure you think it's stable enough as it is to go out; I sort of got confused following all of it. I can try cutting a 6.5.0 if you're good with it.

alistairjevans commented 1 year ago

Yeah, the changes around reflection-cache-clearing went in and are stable I believe.

The pending PR is needed to truly close off the isolated-scope-for-loaded-assembly issue, but the changes as they stand are still good.

tillig commented 1 year ago

OK, I'll see if I can cut a 6.5.0. Probably tomorrow.

tillig commented 1 year ago

https://github.com/autofac/Autofac/releases/tag/v6.5.0 published.

srogovtsev commented 1 year ago

Will you be pushing out a new version of this package as well, with version-bumped dependency?

tillig commented 1 year ago

I hadn't planned on it but I can. It won't be today.

srogovtsev commented 1 year ago

Oh no, if you hadn't planned, don't bother, I just wanted to know if we'd have one more upgrade in our dependency tracking queue. We can simply bump Autofac version on our end.

tillig commented 1 year ago

Autofac.Owin has a version range dependency right now:

<PackageReference Include="Autofac" Version="[6.0.0, 7.0.0)" />

which is reflected on nuget.org as well.

Thus, I think the actual solution is to update on the client end. There's no new package here to issue.

I'm going to close this for now under the assumption things are going to work out. If there's some other action we need to take, post and we can reopen the ticket. Thanks!