| ... | ... | @@ -3151,6 +3151,17 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) UpdateE |
| 3151 | 3151 | // cache manifest must not be written. |
| 3152 | 3152 | if (anyErrors(comp)) return; |
| 3153 | 3153 | |
| 3154 | // Release the lock and close the file before writing the manifest. |
| 3155 | // This avoids the potential of another process getting a cache hit and |
| 3156 | // trying to spawn a process with it while there's still an open fd to it. |
| 3157 | if (comp.bin_file) |lf| { |
| 3158 | lf.releaseLock(); |
| 3159 | if (lf.file) |f| { |
| 3160 | f.close(io); |
| 3161 | lf.file = null; |
| 3162 | } |
| 3163 | } |
| 3164 | |
| 3154 | 3165 | // Failure here only means an unnecessary cache miss. |
| 3155 | 3166 | man.writeManifest() catch |err| log.warn("failed to write cache manifest: {t}", .{err}); |
| 3156 | 3167 | |