dragonfly
dragonfly copied to clipboard
Dragonfly crashes during JSON.SET command when experimental_flat_json is enabled
How to reproduce: run in the redis-cli:
json.set j1 . '{"v":"v"}'
> ./dragonfly --alsologtostderr --experimental_flat_json=true
I20241216 15:25:10.743274 823338 init.cc:78] ./dragonfly running in opt mode.
* Logs will be written to the first available of the following paths:
/tmp/dragonfly.*
./dragonfly.*
* For the available flags type dragonfly [--help | --helpfull]
* Documentation can be found at: https://www.dragonflydb.io/docs
I20241216 15:25:10.743471 823338 dfly_main.cc:691] Starting dragonfly df-dev-0000000
I20241216 15:25:10.743598 823338 dfly_main.cc:735] maxmemory has not been specified. Deciding myself....
I20241216 15:25:10.743606 823338 dfly_main.cc:744] Found 18.52GiB available memory. Setting maxmemory to 14.81GiB
I20241216 15:25:10.747597 823339 uring_proactor.cc:178] IORing with 1024 entries, allocated 98368 bytes, cq_entries is 2048
I20241216 15:25:10.822304 823338 proactor_pool.cc:147] Running 16 io threads
I20241216 15:25:10.824172 823338 server_family.cc:826] Host OS: Linux 6.8.0-50-generic x86_64 with 16 threads
I20241216 15:25:10.824293 823338 snapshot_storage.cc:185] Load snapshot: Searching for snapshot in directory: "/home/bagrstepan/Documents/GitHub/dragonfly/build-opt"
W20241216 15:25:10.824368 823338 server_family.cc:941] Load snapshot: No snapshot found
I20241216 15:25:10.824476 823340 listener_interface.cc:101] sock[36] AcceptServer - listening on port 6379
*** SIGSEGV received at time=1734348322 on cpu 0 ***
PC: @ 0x5c95fb68da0b (unknown) reflex::Matcher::match()
@ 0x7a9c47137d9c 224 __snprintf_chk
@ 0x7a9c4003e470 272 (unknown)
@ ... and at least 1 more frames
Segmentation fault (core dumped)
The issue is in CompactObj::GetJson() where the flat JSON case is not being handled correctly.
Note, that experimental_flat_json is not something we use in production and it's not enabled by default.