Skip to content

Mismatch between domain reload handling in soft debugger client and agent. #57

Open
@lukaszunity

Description

@lukaszunity

I'm submitting this issue as a starting point for a discussion on how to fix a mismatch between how the soft debugger client and agent handle domain reloads.

The debugger agent registers new types (mirrors) with a type + domain pair.
https://github.com/mono/mono/blob/master/mono/mini/debugger-agent.c#L2276
and the types are marked as unloaded when a domain is unloaded.
https://github.com/mono/mono/blob/master/mono/mini/debugger-agent.c#L2210

In the client there is a single cache for all the types across domains
https://github.com/mono/debugger-libs/blob/master/Mono.Debugging.Soft/SoftDebuggerSession.cs#L60
and the types are removed when an assembly is unloaded.
https://github.com/mono/debugger-libs/blob/master/Mono.Debugging.Soft/SoftDebuggerSession.cs#L1879

This causes issues where the agent can unload a type associated with a domain, but if the assembly for the type is not unloaded (due to it being used in another domain), then the client will have a reference to a type that is marked as unloaded in the agent.

Zoltan Varga told me the following when I asked whether this was problem in the debugger agent: "Conceptually, assemblies are loaded into each domain they are referenced, so a reference to a type is really a reference to a type+domain pair, this is how the runtime code works. I think the problem is in the debugger-libs code, which should handle this the same way as the runtime code does, i.e. keep things in domain specific caches, and invalidate those caches when a domain is unloaded, not when an assembly is unloaded."

Would you accept PRs that address this issue and if so, do you have any suggestions for how to go about fixing it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions