mirror of
https://github.com/NixOS/nix.git
synced 2025-02-16 17:02:28 +00:00
Merge pull request #11922 from picnoir/pic/catch-gc-exception
gc: resume GC after a pathinuse error
This commit is contained in:
commit
c13c6066b7
@ -4,6 +4,7 @@
|
|||||||
#include "finally.hh"
|
#include "finally.hh"
|
||||||
#include "unix-domain-socket.hh"
|
#include "unix-domain-socket.hh"
|
||||||
#include "signals.hh"
|
#include "signals.hh"
|
||||||
|
#include "posix-fs-canonicalise.hh"
|
||||||
|
|
||||||
#if !defined(__linux__)
|
#if !defined(__linux__)
|
||||||
// For shelling out to lsof
|
// For shelling out to lsof
|
||||||
@ -763,13 +764,18 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto & path : topoSortPaths(visited)) {
|
for (auto & path : topoSortPaths(visited)) {
|
||||||
if (!dead.insert(path).second) continue;
|
if (!dead.insert(path).second) continue;
|
||||||
if (shouldDelete) {
|
if (shouldDelete) {
|
||||||
invalidatePathChecked(path);
|
try {
|
||||||
deleteFromStore(path.to_string());
|
invalidatePathChecked(path);
|
||||||
referrersCache.erase(path);
|
deleteFromStore(path.to_string());
|
||||||
|
referrersCache.erase(path);
|
||||||
|
} catch (PathInUse &e) {
|
||||||
|
// If we end up here, it's likely a new occurence
|
||||||
|
// of https://github.com/NixOS/nix/issues/11923
|
||||||
|
printError("BUG: %s", e.what());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user