move-language / move

Apache License 2.0
2.25k stars 679 forks source link

[loader] Remove double-insertion invariant violation #1007

Closed amnn closed 1 year ago

amnn commented 1 year ago

Turns out that we already double insert into the loader: when two requests to load a module come in at the same time, both will find the loaded and compiled module caches empty, so both will start the process of verifying the module and insert it. The last write wins, and the older write's binaries entry leaks.

Removing the invariant violation check, and accepting that we will sometimes leak entries as the alternative is to hold the lock for longer in the critical path, which will be too detrimental for performance.

Test Plan

$ cargo nextest