Closed
Description
Version: redis-py: 3.5.3
Platform: Python 3.10.11 mac
Description:
The redis monitor command parsing can break for certain messages (has been happening with byte strings that contain the substring "] "
).
Basically, the fix is to make the client_info regex non-greedy:
# original
monitor_re = re.compile(r"\[(\d+) (.*)\] (.*)")
# fix:
monitor_re = re.compile(r"\[(\d+) (.*?)\] (.*)")
You can test here: https://regexr.com/
An example that works
[0 172.18.0.4:36030] "XADD" "default:main" "MAXLEN" "~" "1000" "*" "d" "asdf"
An example that breaks the original regex
[0 172.18.0.4:36030] "XADD" "default:main" "MAXLEN" "~" "1000" "*" "d" "] "
The assumption being that the client_info would never contain "] " which seems to be the case from what I can tell.
Metadata
Metadata
Assignees
Labels
No labels