Fix crash when client running async keys disconnects before keys finishes
Former-commit-id: dd9233c49d82c89a9d92b7251a56f91c2ee98e77
This commit is contained in:
parent
5e692ff15a
commit
fbc7821244
@ -111,6 +111,8 @@ void blockClient(client *c, int btype) {
|
||||
serverAssert(GlobalLocksAcquired());
|
||||
c->flags |= CLIENT_BLOCKED;
|
||||
c->btype = btype;
|
||||
if (btype == BLOCKED_ASYNC)
|
||||
c->casyncOpsPending++;
|
||||
g_pserver->blocked_clients++;
|
||||
g_pserver->blocked_clients_by_type[btype]++;
|
||||
}
|
||||
@ -191,7 +193,8 @@ void unblockClient(client *c) {
|
||||
} else if (c->btype == BLOCKED_MODULE) {
|
||||
unblockClientFromModule(c);
|
||||
} else if (c->btype == BLOCKED_ASYNC) {
|
||||
|
||||
serverAssert(c->casyncOpsPending > 0);
|
||||
c->casyncOpsPending--;
|
||||
} else {
|
||||
serverPanic("Unknown btype in unblockClient().");
|
||||
}
|
||||
|
@ -1624,7 +1624,7 @@ void ProcessPendingAsyncWrites()
|
||||
|
||||
std::atomic_thread_fence(std::memory_order_seq_cst);
|
||||
|
||||
if (c->casyncOpsPending == 0)
|
||||
if (c->casyncOpsPending == 0 || c->btype == BLOCKED_ASYNC) // It's ok to send data if we're in a bgthread op
|
||||
{
|
||||
if (FCorrectThread(c))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user