Fix server assert on ACL LOAD and resetchannels#3182
Fix server assert on ACL LOAD and resetchannels#3182zuiderkwast merged 3 commits intovalkey-io:unstablefrom
Conversation
Signed-off-by: Daniil Kashapov <daniil.kashapov.ykt@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #3182 +/- ##
============================================
+ Coverage 74.92% 74.94% +0.01%
============================================
Files 129 129
Lines 71329 71333 +4
============================================
+ Hits 53441 53457 +16
+ Misses 17888 17876 -12
🚀 New features to boost your workflow:
|
|
Hi @madolson, can you PTAL at small fix for freeing deleted ACL users from ACL LOAD? |
Nikhil-Manglore
left a comment
There was a problem hiding this comment.
Thanks for the quick fix
madolson
left a comment
There was a problem hiding this comment.
There is another crash pathway we should fix. More generally, I wonder if we should do something in the freeClient function to just not free the client if we're currently in a a command?
@madolson You mean like this? void freeClient(c) {
if (c == current_client) {
c->flag.close_after_command = 1;
return;
}
...
} |
Effectively yeah. I was tracing through the |
|
I don't think we can do this: void freeClient(c) {
if (c == current_client) {
c->flag.close_after_command = 1;
return;
}
...
}Because:
Maybe we can do this but IDK if this will break something else: if (c == server.current_client && c->flag.executing_command) {
c->flag.close_after_command = 1;
return;
} |
Signed-off-by: Daniil Kashapov <daniil.kashapov.ykt@gmail.com>
These won't be in the context of a command, so server.current_client won't be set. I don't know, I was just hoping there was some better solution :/ |
madolson
left a comment
There was a problem hiding this comment.
Two small suggestions, otherwise it looks good functionality wise.
Co-authored-by: Madelyn Olson <madelyneolson@gmail.com> Signed-off-by: Daniil Kashapov <daniil.kashapov.ykt@gmail.com>
If the client executing `ACL LOAD` is a user that is removed from ACL file, it frees itself while still executing the command. Same happens for user while removing it's channel permissions. This causes `c->conn` pointer to become `null` and later `serverAssert(c->conn)` fails for that client on write in `prepareClientToWrite()`. Solution is to flag current client to be closed after command completes and reply is written, later this client is freed async. Resolves valkey-io#3181 --------- Signed-off-by: Daniil Kashapov <daniil.kashapov.ykt@gmail.com> Co-authored-by: Madelyn Olson <madelyneolson@gmail.com> Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
If the client executing `ACL LOAD` is a user that is removed from ACL file, it frees itself while still executing the command. Same happens for user while removing it's channel permissions. This causes `c->conn` pointer to become `null` and later `serverAssert(c->conn)` fails for that client on write in `prepareClientToWrite()`. Solution is to flag current client to be closed after command completes and reply is written, later this client is freed async. Resolves valkey-io#3181 --------- Signed-off-by: Daniil Kashapov <daniil.kashapov.ykt@gmail.com> Co-authored-by: Madelyn Olson <madelyneolson@gmail.com> Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
If the client executing `ACL LOAD` is a user that is removed from ACL file, it frees itself while still executing the command. Same happens for user while removing it's channel permissions. This causes `c->conn` pointer to become `null` and later `serverAssert(c->conn)` fails for that client on write in `prepareClientToWrite()`. Solution is to flag current client to be closed after command completes and reply is written, later this client is freed async. Resolves valkey-io#3181 --------- Signed-off-by: Daniil Kashapov <daniil.kashapov.ykt@gmail.com> Co-authored-by: Madelyn Olson <madelyneolson@gmail.com>
If the client executing `ACL LOAD` is a user that is removed from ACL file, it frees itself while still executing the command. Same happens for user while removing it's channel permissions. This causes `c->conn` pointer to become `null` and later `serverAssert(c->conn)` fails for that client on write in `prepareClientToWrite()`. Solution is to flag current client to be closed after command completes and reply is written, later this client is freed async. Resolves valkey-io#3181 --------- Signed-off-by: Daniil Kashapov <daniil.kashapov.ykt@gmail.com> Co-authored-by: Madelyn Olson <madelyneolson@gmail.com> Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
If the client executing `ACL LOAD` is a user that is removed from ACL file, it frees itself while still executing the command. Same happens for user while removing it's channel permissions. This causes `c->conn` pointer to become `null` and later `serverAssert(c->conn)` fails for that client on write in `prepareClientToWrite()`. Solution is to flag current client to be closed after command completes and reply is written, later this client is freed async. Resolves valkey-io#3181 --------- Signed-off-by: Daniil Kashapov <daniil.kashapov.ykt@gmail.com> Co-authored-by: Madelyn Olson <madelyneolson@gmail.com>
If the client executing `ACL LOAD` is a user that is removed from ACL file, it frees itself while still executing the command. Same happens for user while removing it's channel permissions. This causes `c->conn` pointer to become `null` and later `serverAssert(c->conn)` fails for that client on write in `prepareClientToWrite()`. Solution is to flag current client to be closed after command completes and reply is written, later this client is freed async. Resolves valkey-io#3181 --------- Signed-off-by: Daniil Kashapov <daniil.kashapov.ykt@gmail.com> Co-authored-by: Madelyn Olson <madelyneolson@gmail.com> Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
If the client executing `ACL LOAD` is a user that is removed from ACL file, it frees itself while still executing the command. Same happens for user while removing it's channel permissions. This causes `c->conn` pointer to become `null` and later `serverAssert(c->conn)` fails for that client on write in `prepareClientToWrite()`. Solution is to flag current client to be closed after command completes and reply is written, later this client is freed async. Resolves valkey-io#3181 --------- Signed-off-by: Daniil Kashapov <daniil.kashapov.ykt@gmail.com> Co-authored-by: Madelyn Olson <madelyneolson@gmail.com> Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
If the client executing `ACL LOAD` is a user that is removed from ACL file, it frees itself while still executing the command. Same happens for user while removing it's channel permissions. This causes `c->conn` pointer to become `null` and later `serverAssert(c->conn)` fails for that client on write in `prepareClientToWrite()`. Solution is to flag current client to be closed after command completes and reply is written, later this client is freed async. Resolves #3181 --------- Signed-off-by: Daniil Kashapov <daniil.kashapov.ykt@gmail.com> Co-authored-by: Madelyn Olson <madelyneolson@gmail.com> Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
If the client executing `ACL LOAD` is a user that is removed from ACL file, it frees itself while still executing the command. Same happens for user while removing it's channel permissions. This causes `c->conn` pointer to become `null` and later `serverAssert(c->conn)` fails for that client on write in `prepareClientToWrite()`. Solution is to flag current client to be closed after command completes and reply is written, later this client is freed async. Resolves #3181 --------- Signed-off-by: Daniil Kashapov <daniil.kashapov.ykt@gmail.com> Co-authored-by: Madelyn Olson <madelyneolson@gmail.com> Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
If the client executing `ACL LOAD` is a user that is removed from ACL file, it frees itself while still executing the command. Same happens for user while removing it's channel permissions. This causes `c->conn` pointer to become `null` and later `serverAssert(c->conn)` fails for that client on write in `prepareClientToWrite()`. Solution is to flag current client to be closed after command completes and reply is written, later this client is freed async. Resolves #3181 --------- Signed-off-by: Daniil Kashapov <daniil.kashapov.ykt@gmail.com> Co-authored-by: Madelyn Olson <madelyneolson@gmail.com> Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
if the client executing
ACL LOADis a user that is removed from ACL file, it frees itself while still executing the command. Same happens for user while removing it's channel permissions.This causes
c->connpointer to becomenulland laterserverAssert(c->conn)fails for that client on write inprepareClientToWrite().Solution is to flag current client to be closed after command completes and reply is written, later this client is freed async.
Bug is present in 8.0, 8.1, 9.0.
Resolves #3181