-
Notifications
You must be signed in to change notification settings - Fork 955
Fix engine crash on module client blocking during keyspace events #1819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a064f39 to
74cb5e4
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #1819 +/- ##
============================================
+ Coverage 70.99% 71.03% +0.04%
============================================
Files 123 123
Lines 65651 66033 +382
============================================
+ Hits 46609 46909 +300
- Misses 19042 19124 +82
🚀 New features to boost your workflow:
|
2428ae0 to
7c9cff2
Compare
dd60c6a to
0445d46
Compare
…lkey-io#1819) This change enhances user experience and consistency by allowing a module to block a client on keyspace event notifications. Consistency is improved by allowing that reads after writes on the same connection yield expected results. For example, in ValkeySearch, mutations processed earlier on the same connection will be available for search. The implementation extends `VM_BlockClient` to support blocking clients on keyspace event notifications. Internal clients, LUA clients, clients issueing multi exec and those with the `deny_blocking` flag set are not blocked. Once blocked, a client’s reply is withheld until it is explicitly unblocked. --------- Signed-off-by: yairgott <[email protected]> Signed-off-by: Jacob Murphy <[email protected]>
…lkey-io#1819) This change enhances user experience and consistency by allowing a module to block a client on keyspace event notifications. Consistency is improved by allowing that reads after writes on the same connection yield expected results. For example, in ValkeySearch, mutations processed earlier on the same connection will be available for search. The implementation extends `VM_BlockClient` to support blocking clients on keyspace event notifications. Internal clients, LUA clients, clients issueing multi exec and those with the `deny_blocking` flag set are not blocked. Once blocked, a client’s reply is withheld until it is explicitly unblocked. --------- Signed-off-by: yairgott <[email protected]> Signed-off-by: Nitai Caro <[email protected]>
…lkey-io#1819) This change enhances user experience and consistency by allowing a module to block a client on keyspace event notifications. Consistency is improved by allowing that reads after writes on the same connection yield expected results. For example, in ValkeySearch, mutations processed earlier on the same connection will be available for search. The implementation extends `VM_BlockClient` to support blocking clients on keyspace event notifications. Internal clients, LUA clients, clients issueing multi exec and those with the `deny_blocking` flag set are not blocked. Once blocked, a client’s reply is withheld until it is explicitly unblocked. --------- Signed-off-by: yairgott <[email protected]>
…lkey-io#1819) This change enhances user experience and consistency by allowing a module to block a client on keyspace event notifications. Consistency is improved by allowing that reads after writes on the same connection yield expected results. For example, in ValkeySearch, mutations processed earlier on the same connection will be available for search. The implementation extends `VM_BlockClient` to support blocking clients on keyspace event notifications. Internal clients, LUA clients, clients issueing multi exec and those with the `deny_blocking` flag set are not blocked. Once blocked, a client’s reply is withheld until it is explicitly unblocked. --------- Signed-off-by: yairgott <[email protected]>
Could be. I suspect that the following should be moved to line 501. I'll give it a try. |
Yeah, it fixed it. See #1989 |
See #1819 (comment) Verified the fix by: 1. Build: `make SERVER_CFLAGS='-Werror -DLOG_REQ_RES' -j10` 2. Running module api tests: `CFLAGS='-Werror' ./runtest-moduleapi --log-req-res --no-latency --dont-clean --force-resp3 --dont-pre-clean --verbose --dump-logs` --------- Signed-off-by: yairgott <[email protected]>
…lkey-io#1819) This change enhances user experience and consistency by allowing a module to block a client on keyspace event notifications. Consistency is improved by allowing that reads after writes on the same connection yield expected results. For example, in ValkeySearch, mutations processed earlier on the same connection will be available for search. The implementation extends `VM_BlockClient` to support blocking clients on keyspace event notifications. Internal clients, LUA clients, clients issueing multi exec and those with the `deny_blocking` flag set are not blocked. Once blocked, a client’s reply is withheld until it is explicitly unblocked. --------- Signed-off-by: yairgott <[email protected]> Signed-off-by: Jacob Murphy <[email protected]>
See valkey-io#1819 (comment) Verified the fix by: 1. Build: `make SERVER_CFLAGS='-Werror -DLOG_REQ_RES' -j10` 2. Running module api tests: `CFLAGS='-Werror' ./runtest-moduleapi --log-req-res --no-latency --dont-clean --force-resp3 --dont-pre-clean --verbose --dump-logs` --------- Signed-off-by: yairgott <[email protected]> Signed-off-by: Jacob Murphy <[email protected]>
) This change enhances user experience and consistency by allowing a module to block a client on keyspace event notifications. Consistency is improved by allowing that reads after writes on the same connection yield expected results. For example, in ValkeySearch, mutations processed earlier on the same connection will be available for search. The implementation extends `VM_BlockClient` to support blocking clients on keyspace event notifications. Internal clients, LUA clients, clients issueing multi exec and those with the `deny_blocking` flag set are not blocked. Once blocked, a client’s reply is withheld until it is explicitly unblocked. --------- Signed-off-by: yairgott <[email protected]> Signed-off-by: Jacob Murphy <[email protected]>
See #1819 (comment) Verified the fix by: 1. Build: `make SERVER_CFLAGS='-Werror -DLOG_REQ_RES' -j10` 2. Running module api tests: `CFLAGS='-Werror' ./runtest-moduleapi --log-req-res --no-latency --dont-clean --force-resp3 --dont-pre-clean --verbose --dump-logs` --------- Signed-off-by: yairgott <[email protected]> Signed-off-by: Jacob Murphy <[email protected]>
…lkey-io#1819) This change enhances user experience and consistency by allowing a module to block a client on keyspace event notifications. Consistency is improved by allowing that reads after writes on the same connection yield expected results. For example, in ValkeySearch, mutations processed earlier on the same connection will be available for search. The implementation extends `VM_BlockClient` to support blocking clients on keyspace event notifications. Internal clients, LUA clients, clients issueing multi exec and those with the `deny_blocking` flag set are not blocked. Once blocked, a client’s reply is withheld until it is explicitly unblocked. --------- Signed-off-by: yairgott <[email protected]> Signed-off-by: hwware <[email protected]>
See valkey-io#1819 (comment) Verified the fix by: 1. Build: `make SERVER_CFLAGS='-Werror -DLOG_REQ_RES' -j10` 2. Running module api tests: `CFLAGS='-Werror' ./runtest-moduleapi --log-req-res --no-latency --dont-clean --force-resp3 --dont-pre-clean --verbose --dump-logs` --------- Signed-off-by: yairgott <[email protected]> Signed-off-by: hwware <[email protected]>
See valkey-io#1819 (comment) Verified the fix by: 1. Build: `make SERVER_CFLAGS='-Werror -DLOG_REQ_RES' -j10` 2. Running module api tests: `CFLAGS='-Werror' ./runtest-moduleapi --log-req-res --no-latency --dont-clean --force-resp3 --dont-pre-clean --verbose --dump-logs` --------- Signed-off-by: yairgott <[email protected]>
This flag.deny_blocking check causes some code to becomde dead code. Some of the code below checks islua or ismulti, but they are marked with flag.deny_blocking and will return early. In addition, cleanup some documents, some of them are inaccurate, and restore the code of blocking_auth_cb in tests/modules/auth.c, this reply should be returned from core. The reply used to from the core and was changed to from the module in valkey-io#1819, and now it is from the core again. Cleanup some dead code around valkey-io#1819. Signed-off-by: Binbin <[email protected]>
When we add f8a5a4f, a module auth can add reply in its callback, or not add reply and just return an error robj in its callback, and we have to figure a way to determine whether it has added the reply. Before we are using `clientHasPendingReplies` and it had a issue, the auth might be used inside a transaction or pipeline which already has some pending replies in the client reply list. It causes us to not add the error reply to auth. After valkey-io#1819, now we have a buffered_reply client flag, it indicates the reply for the current command was buffered, either in client::reply or in client::buf. We can use this flag to check. Fixes valkey-io#2106. Signed-off-by: Binbin <[email protected]>
When we add f8a5a4f, a module auth can add reply in its callback, or not add reply and just return an error robj in its callback, and we have to figure a way to determine whether it has added the reply. Before we are using `clientHasPendingReplies` and it had a issue, the auth might be used inside a transaction or pipeline which already has some pending replies in the client reply list. It causes us to not add the error reply to auth. After #1819, now we have a buffered_reply client flag, it indicates the reply for the current command was buffered, either in client::reply or in client::buf. We can use this flag to check. Fixes #2106. --------- Signed-off-by: Binbin <[email protected]>
…y-io#2287) When we add f8a5a4f, a module auth can add reply in its callback, or not add reply and just return an error robj in its callback, and we have to figure a way to determine whether it has added the reply. Before we are using `clientHasPendingReplies` and it had a issue, the auth might be used inside a transaction or pipeline which already has some pending replies in the client reply list. It causes us to not add the error reply to auth. After valkey-io#1819, now we have a buffered_reply client flag, it indicates the reply for the current command was buffered, either in client::reply or in client::buf. We can use this flag to check. Fixes valkey-io#2106. --------- Signed-off-by: Binbin <[email protected]>
…#2215) This flag.deny_blocking check causes some code to becomde dead code. Some of the code below checks islua or ismulti, but they are marked with flag.deny_blocking and will return early. In addition, cleanup some documents, some of them are inaccurate, and restore the code of blocking_auth_cb in tests/modules/auth.c, this reply should be returned from core. The reply used to from the core and was changed to from the module in #1819, and now it is from the core again. Cleanup some dead code around #1819. Signed-off-by: Binbin <[email protected]>
…valkey-io#2215) This flag.deny_blocking check causes some code to becomde dead code. Some of the code below checks islua or ismulti, but they are marked with flag.deny_blocking and will return early. In addition, cleanup some documents, some of them are inaccurate, and restore the code of blocking_auth_cb in tests/modules/auth.c, this reply should be returned from core. The reply used to from the core and was changed to from the module in valkey-io#1819, and now it is from the core again. Cleanup some dead code around valkey-io#1819. Signed-off-by: Binbin <[email protected]>
…#2215) This flag.deny_blocking check causes some code to becomde dead code. Some of the code below checks islua or ismulti, but they are marked with flag.deny_blocking and will return early. In addition, cleanup some documents, some of them are inaccurate, and restore the code of blocking_auth_cb in tests/modules/auth.c, this reply should be returned from core. The reply used to from the core and was changed to from the module in #1819, and now it is from the core again. Cleanup some dead code around #1819. Signed-off-by: Binbin <[email protected]>
…valkey-io#2215) This flag.deny_blocking check causes some code to becomde dead code. Some of the code below checks islua or ismulti, but they are marked with flag.deny_blocking and will return early. In addition, cleanup some documents, some of them are inaccurate, and restore the code of blocking_auth_cb in tests/modules/auth.c, this reply should be returned from core. The reply used to from the core and was changed to from the module in valkey-io#1819, and now it is from the core again. Cleanup some dead code around valkey-io#1819. Signed-off-by: Binbin <[email protected]> Signed-off-by: Harkrishn Patro <[email protected]>
This change enhances user experience and consistency by allowing a module to block a client on keyspace event notifications. Consistency is improved by allowing that reads after writes on the same connection yield expected results. For example, in ValkeySearch, mutations processed earlier on the same connection will be available for search.
The implementation extends
VM_BlockClientto support blocking clients on keyspace event notifications. Internal clients, LUA clients, clients issueing multi exec and those with thedeny_blockingflag set are not blocked. Once blocked, a client’s reply is withheld until it is explicitly unblocked.