Skip to content

AssemblyLoadContext unloadability and 3rd party libraries #116142

Open
@Flohack74

Description

@Flohack74

Hello, I have quite some issues with not being able to unload an ALC that uses the log4net dependency. I already attached a few remarks on #30656 but I feel its worth having a separate issue for that.

What it boils down to is that I have no control over whats happening in any 3rd party library, be it log4net, or, also used by us, DevExpress components. If I use those libs in an ALC and later on I cannot unload them it is a huge blocker for having any 3rd party libs in an ALC, because you will never know under which circumstances they could stay in memory or not.

I dont think that was the intention here, yet it seems to be a real-world problem. I went left and right with the mem profiler already and also with @raffaeler ´s tool PowerDiagnostic to at least understand which object reference keeps the ALC hot, but so far to no avail. Its not a thread/task, also most likely not an event subscription, but more than that I am not sure.

Note that we transitioned from an AppDomain concept into ALC when we migrated from 4.8 to net8 last year. Only now it became evident that this move created memleak issues in our backend. If this is not solveable for us, we need to make a huge refactoring on the code that ideally runs user/client requests in an isolation container.

I got a dump file on request to showcase the issue, and also https://github.com/Flohack74/ALCwithLog4Net holds an example of how the memory builds up with my custom ALC. Grateful for any advice! :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions