drogonframework / drogonframework/drogon

RedisClient::execCommand* incorrectly splits EVAL arguments

Open
#2,587 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
14.3k
Forks
1.4k
Avg merge
1d 13h
Merged PRs (30d)
14

Description

When executing the EVAL command via redisClient->execCommand*, the arguments are incorrectly split.

**C++ code**
```cpp
string command = "EVAL \"redis.call('SET', KEYS[1], 1)\" 1 aaa";
redisClient_->execCommandAsync(
[](const drogon::nosql::RedisResult &result) {
LOG_INFO << result.getStringForDisplaying();
},
[](const drogon::nosql::RedisException &e) {
LOG_ERROR << e.what(); // Output: ERR value is not an integer or out of range
},
command);
```

*‌*Redis Monitor Output (Incorrect):‌**
```
1788764064.250441 [0 172.17.0.1:52148] "EVAL" "\"redis.call('SET'," "KEYS[1]," "1)\"" "1" "aaa"
```

*‌*Expected Monitor Output (Correct):‌**
```
1788764160.024534 [0 172.17.0.1:37362] "EVAL" "redis.call('SET', KEYS[1], 1)" "1" "aaa"
1788764160.029867 [0 lua] "SET" "aaa" "1"
```

Contributor guide

Open the contributing guide

Research direction

Start at RedisClient::execCommandAsync and reproduce the EVAL example from the issue, then trace how its command string is split into Redis arguments. Compare Redis Monitor output with the expected EVAL and SET calls; done means the quoted Lua script remains one argument and the command executes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, redis
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.