{"record":{"id":"7ce824c947a0462f","repo":"dotnet/runtime","slug":"error-fail-to-pal-initializedll-n-7ce824","errorCode":null,"errorMessage":"Error: Fail to PAL_InitializeDLL\\n","messagePattern":"Error: Fail to PAL_InitializeDLL\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/coreclr/tools/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp","lineNumber":80,"sourceCode":"    {\n        g_realJitPath = GetEnvWithDefault(\"SuperPMIShimPath\", g_DefaultRealJitPath.c_str());\n    }\n}\n\nextern \"C\"\n#ifdef HOST_UNIX\n    DLLEXPORT // For Win32 PAL LoadLibrary emulation\n#endif\n        BOOL\n        DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)\n{\n    switch (ul_reason_for_call)\n    {\n        case DLL_PROCESS_ATTACH:\n#ifdef HOST_UNIX\n            if (0 != PAL_InitializeDLL())\n            {\n                fprintf(stderr, \"Error: Fail to PAL_InitializeDLL\\n\");\n                exit(1);\n            }\n#endif // HOST_UNIX\n            break;\n\n        case DLL_PROCESS_DETACH:\n        case DLL_THREAD_ATTACH:\n        case DLL_THREAD_DETACH:\n            break;\n    }\n    return TRUE;\n}\n\nextern \"C\" DLLEXPORT void jitStartup(ICorJitHost* host)\n{\n    SetDefaultPaths();\n    SetLibName();\n    SetDebugDumpVariables();","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/coreclr/tools/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp#L62-L98","documentation":"The SuperPMI shim-simple is the minimal JIT-replay shim that replays a previously captured .mcb/.mcl corpus against a real JIT. On unix, DllMain DLL_PROCESS_ATTACH runs PAL_InitializeDLL and, on non-zero return, prints this message and exit(1). The host process dies at the moment the JIT DLL is loaded.","triggerScenarios":"Loading superpmi-shim-simple on unix when PAL setup fails: the shim and its PAL/runtime siblings are not co-located, the shim was built against a different CoreCLR, arch mismatch, or PAL cannot register signals/map its modules.","commonSituations":"Running replay from a stale artifacts tree after switching branches; pointing SuperPMIShimPath at a directory missing libcoreclrpal; minimal containers that strip locale/proc; mixing x64 and arm64 artifacts.","solutions":["Run replay from the build output directory so the shim and its PAL/runtime siblings load together.","Rebuild the simple shim against the runtime you intend to replay against.","Validate locale (/usr/lib/locale) and /proc availability in the host environment.","strace -f the host to find the first PAL syscall that fails during DLL_PROCESS_ATTACH."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\nset -euo pipefail\nDIR=\"$(dirname \"${DOTNET_JITPATH:-superpmi-shim-simple.so}\")\"\nfile \"$DIR/superpmi-shim-simple.so\" | grep -qi \"$(uname -m)\" || exit 1\nldd \"$DIR/superpmi-shim-simple.so\" 2>/dev/null | grep -q 'not found' && exit 1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the simple shim from its artifacts/bin directory with all siblings.","Rebuild it against the runtime you replay against.","Keep locales and /proc available in the host environment.","strace at JIT load to catch the failing PAL syscall."],"tags":["superpmi","shim-simple","pal","dllmain","initialization","unix","jit"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}