Skip to content

GetProcAddress in DllMain is problematic (causes deadlocks) #163

@topolarity

Description

@topolarity

These lookups (introduced in #114):

for (symbol_idx=0; exported_func_names[symbol_idx] != NULL; ++symbol_idx) {
exported_func32[symbol_idx] = lookup_self_symbol(exported_func_names[symbol_idx]);
// Look up this symbol in the given library, if it is a valid symbol, set it!
build_symbol_name(symbol_name, exported_func_names[symbol_idx], "64_");
exported_func64[symbol_idx] = lookup_self_symbol(symbol_name);
}
can deadlock in combination with a parallel dbghelp!SymRefreshModuleList() call (and probably much more).

This leads to hangs in downstream CI (JuliaLang/julia#59650 (comment)) if Profile uses dbghelp concurrently while LBT is being (lazily) loaded.

According to @vtjnash, it is not legal to perform a GetProcAddress inside DllMain on Windows.

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