Serialize build retirement and clone classification, bound ops accepts
Review fixes for M7.6-M7.9. Schema v9 applies one lock order: the barrier takes a database-wide upgrade lock exclusively, while acquisitions, lease checks, provisioning and the retired-build trigger take it shared first, so a queued acquisition can no longer regain authority for a just-retired build and concurrent barriers cannot retire the last current build. Provisioning takes a per-world lock before classifying a world as original or a clone of one source. The operations listener makes at most four accept attempts per serve(). Race regressions prove each contender is blocked before commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -123,8 +123,8 @@ void OpsServer::respond(Connection& c, const OpsHandler& handler) {
|
||||
}
|
||||
|
||||
void OpsServer::serve(const OpsHandler& handler) {
|
||||
const auto now = Clock::now();
|
||||
for (;;) {
|
||||
const auto accepted_at = Clock::now();
|
||||
for (std::size_t attempt = 0; attempt < max_accepts_per_serve; ++attempt) {
|
||||
const int fd = ::accept4(fd_, nullptr, nullptr, SOCK_NONBLOCK | SOCK_CLOEXEC);
|
||||
if (fd < 0)
|
||||
break; // EAGAIN: nothing pending (other errors: retried next call).
|
||||
@@ -133,8 +133,9 @@ void OpsServer::serve(const OpsHandler& handler) {
|
||||
++refused_;
|
||||
continue;
|
||||
}
|
||||
connections_.push_back({fd, {}, {}, 0, now + connection_deadline});
|
||||
connections_.push_back({fd, {}, {}, 0, accepted_at + connection_deadline});
|
||||
}
|
||||
const auto now = Clock::now(); // Deadlines are judged after the bounded accept work.
|
||||
for (auto it = connections_.begin(); it != connections_.end();) {
|
||||
auto& c = *it;
|
||||
bool done = false;
|
||||
|
||||
Reference in New Issue
Block a user