Skip to content

Fix worker assembly loading bug #448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 26, 2025
Merged

Conversation

jasongin
Copy link
Member

Fixes: #447

When multiple worker threads (or main + worker) attempt to resolve the same dependency assembly, loads failed after the first one. The bug was caused by a duplicate-key exception trying to update the internal dictionary that tracks loaded assemblies:

_loadedAssembliesByPath.Add(assemblyFilePath, assembly);

The fix skips loading the requested assembly if it is already in that dictionary, and also switches to ConcurrentDictionary in case multiple threads access it simultaneously.

@jasongin jasongin merged commit 437b69f into main Jun 26, 2025
15 of 16 checks passed
@jasongin jasongin deleted the dev/jasongin/worker-assembly-load branch June 26, 2025 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node workers + Microsoft assembly loading failure
2 participants