tporadowski/rejson

Crash when running badly formatted commands

diplopito opened this issue · 0 comments

Hi Tomasz,

After trying to use JSON.SET or JSON.GET with wrong commands with PhpRedis (ie. passing an array instead of scalar values), Redis crashes with the following error:

=== REDIS BUG REPORT START: Cut & paste starting from here ===
Redis version: 5.0.10
[7604] 06 May 16:05:21.215 # --- EXCEPTION_ACCESS_VIOLATION
[7604] 06 May 16:05:21.216 # --- STACK TRACE
redis-server.exe!StackTraceInfo(D:\dev\GitHub\redis\src\Win32_Interop\Win32_StackTrace.cpp:153)(0x14018CEB0, 0x0014FF60, 0x1400DC620, 0x0014DF80)
redis-server.exe!UnhandledExceptiontHandler(D:\dev\GitHub\redis\src\Win32_Interop\Win32_StackTrace.cpp:186)(0x0014DF80, 0x1400DC601, 0x00000000, 0x00000000)
KERNELBASE.dll!UnhandledExceptionFilter(D:\dev\GitHub\redis\src\Win32_Interop\Win32_StackTrace.cpp:186)(0x0014E030, 0x7FFB839F662C, 0x00000000, 0x0014DFC8)
ntdll.dll!memset(D:\dev\GitHub\redis\src\Win32_Interop\Win32_StackTrace.cpp:186)(0x7FFB83A22A24, 0x7FFB838B0000, 0x0014E030, 0x7FFB838E0E7B)
ntdll.dll!_C_specific_handler(D:\dev\GitHub\redis\src\Win32_Interop\Win32_StackTrace.cpp:186)(0x00000000, 0x0014E530, 0x0014EBF0, 0x00000000)
ntdll.dll!_chkstk(D:\dev\GitHub\redis\src\Win32_Interop\Win32_StackTrace.cpp:186)(0x00000000, 0x0014E530, 0x0014EBF0, 0x00000000)
ntdll.dll!RtlRaiseException(D:\dev\GitHub\redis\src\Win32_Interop\Win32_StackTrace.cpp:186)(0x0014EB01, 0x03813328, 0x7FA51C002400, 0x14009AB7E)
ntdll.dll!KiUserExceptionDispatcher(D:\dev\GitHub\redis\src\Win32_Interop\Win32_StackTrace.cpp:186)(0x140049F58, 0x7FA51C002400, 0x2C91DF3852E245, 0x1401F7B81)
ntdll.dll!KiUserExceptionDispatcher(D:\dev\GitHub\redis\src\Win32_Interop\Win32_StackTrace.cpp:186)(0x7FA51C002400, 0x2C91DF3852E245, 0x1401F7B81, 0x000002DC)
redis-server.exe!rdbSaveObject(D:\dev\GitHub\redis\src\rdb.c:1009)(0x00000001, 0x140048307, 0x1D742787846CDC8, 0x0014F1F0)
redis-server.exe!rdbSaveKeyValuePair(D:\dev\GitHub\redis\src\rdb.c:1073)(0x0014F1F0, 0x00000000, 0x06C00000, 0x00000009)
redis-server.exe!rdbSaveRio(D:\dev\GitHub\redis\src\rdb.c:1219)(0x0050A220, 0x00E20000, 0x00000000, 0x00001DB4)
redis-server.exe!rdbSave(D:\dev\GitHub\redis\src\rdb.c:1321)(0x022493C8, 0x00E20000, 0x00E20000, 0x7FA537000000)
redis-server.exe!QForkChildInit(D:\dev\GitHub\redis\src\Win32_Interop\Win32_QFork.cpp:298)(0x000001D4, 0x00000000, 0x000001D4, 0x0044B910)
redis-server.exe!main(D:\dev\GitHub\redis\src\Win32_Interop\Win32_QFork.cpp:1137)(0x00000000, 0x00000000, 0x0043D060, 0x00000000)
redis-server.exe!__scrt_common_main_seh(D:\agent\_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)(0x00000000, 0x00000000, 0x00000000, 0x00000000)
KERNEL32.DLL!BaseThreadInitThunk(D:\agent\_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)(0x00000000, 0x00000000, 0x00000000, 0x00000000)
ntdll.dll!RtlUserThreadStart(D:\agent\_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)(0x00000000, 0x00000000, 0x00000000, 0x00000000)
ntdll.dll!RtlUserThreadStart(D:\agent\_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)(0x00000000, 0x00000000, 0x00000000, 0x00000000)
[7604] 06 May 16:05:21.222 # --- INFO OUTPUT
[15232] 06 May 16:05:23.285 - DB 0: 11 keys (0 volatile) in 16 slots HT.
[15232] 06 May 16:05:23.285 - 2 clients connected (0 replicas), 729384 bytes in use
[15232] 06 May 16:05:24.390 # fork operation failed
[15232] 06 May 16:05:24.406 # Background saving terminated by signal 1
[15232] 06 May 16:05:27.022 * 1 changes in 900 seconds. Saving...
[15232] 06 May 16:05:27.043 * Background saving started by pid 18732

After this comes a new message on every request:

(error) MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. 
Commands that may modify the data set are disabled, because this instance is configured to report errors 
during writes if RDB snap shotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs
for details about the RDB error

Restarting the service solves this issue --definitely not the best solution.