File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -2315,6 +2315,8 @@ void processInputBuffer(client *c, int callFlags) {
2315
2315
/* Immediately abort if the client is in the middle of something. */
2316
2316
if (c->flags & CLIENT_BLOCKED) break ;
2317
2317
2318
+ if (c->flags & CLIENT_EXECUTING_COMMAND) break ;
2319
+
2318
2320
/* Don't process input from the master while there is a busy script
2319
2321
* condition on the replica. We want just to accumulate the replication
2320
2322
* stream (instead of replying -BUSY like we do with other clients) and
@@ -2349,13 +2351,16 @@ void processInputBuffer(client *c, int callFlags) {
2349
2351
if (c->argc == 0 ) {
2350
2352
resetClient (c);
2351
2353
} else {
2354
+ c->flags |= CLIENT_EXECUTING_COMMAND;
2352
2355
/* We are finally ready to execute the command. */
2353
2356
if (processCommandAndResetClient (c, callFlags) == C_ERR) {
2354
2357
/* If the client is no longer valid, we avoid exiting this
2355
2358
* loop and trimming the client buffer later. So we return
2356
2359
* ASAP in that case. */
2360
+ c->flags &= ~CLIENT_EXECUTING_COMMAND;
2357
2361
return ;
2358
2362
}
2363
+ c->flags &= ~CLIENT_EXECUTING_COMMAND;
2359
2364
}
2360
2365
}
2361
2366
Original file line number Diff line number Diff line change @@ -441,10 +441,8 @@ extern int configOOMScoreAdjValuesDefaults[CONFIG_OOM_COUNT];
441
441
#define CLIENT_PENDING_READ (1 <<29 ) /* The client has pending reads and was put
442
442
in the list of clients we can read
443
443
from. */
444
- #define CLIENT_PENDING_COMMAND (1 <<30 ) /* Used in threaded I/O to signal after
445
- we return single threaded that the
446
- client has already pending commands
447
- to be executed. */
444
+ #define CLIENT_EXECUTING_COMMAND (1 <<30 ) /* Used to handle reentrency cases in processCommandWhileBlocked
445
+ to ensure we don't process a client already executing */
448
446
#define CLIENT_TRACKING (1ULL <<31 ) /* Client enabled keys tracking in order to
449
447
perform client side caching. */
450
448
#define CLIENT_TRACKING_BROKEN_REDIR (1ULL <<32 ) /* Target client is invalid. */
Original file line number Diff line number Diff line change @@ -430,6 +430,21 @@ start_server {tags {"scripting"}} {
430
430
set res
431
431
} {102}
432
432
433
+ test {EVAL with pipelined command (No crash)} {
434
+ r flushall
435
+ r config set lua-time-limit 1
436
+ set rd [redis_deferring_client]
437
+ $rd eval {for i=1,1000000 do redis.call('set', i, 'sdfdsfd') end} 0
438
+ $rd set testkey foo
439
+ $rd get testkey
440
+ after 1200
441
+ catch {r echo " foo" } err
442
+ assert_match {BUSY*} $err
443
+ $rd read
444
+ $rd close
445
+ }
446
+
447
+
433
448
test {EVAL timeout from AOF} {
434
449
# generate a long running script that is propagated to the AOF as script
435
450
# make sure that the script times out during loading
You can’t perform that action at this time.
0 commit comments