Free module context even if there was no content written in auxsave2#2132
Conversation
Signed-off-by: Jacob Murphy <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #2132 +/- ##
============================================
- Coverage 71.18% 71.07% -0.11%
============================================
Files 122 122
Lines 66046 66049 +3
============================================
- Hits 47013 46943 -70
- Misses 19033 19106 +73
🚀 New features to boost your workflow:
|
zuiderkwast
left a comment
There was a problem hiding this comment.
Fix looks correct to me.
Ideally we should have a test covering this path. There seems to be test code for it in https://github.com/valkey-io/valkey/blob/8.1.1/tests/modules/testrdb.c#L350-L360 and test cases https://github.com/valkey-io/valkey/blob/8.1.1/tests/unit/moduleapi/testrdb.tcl#L30-L57. Why didn't these test cases catch this bug?
|
@murphyjacob4 If the module wants to support older Valkey without this fix, it still needs some workaround for this bug, right? |
Right. It would be required that, if a module is using auxsave2, the module context is not created from the RDB (via VM_GetContextFromIO https://github.com/valkey-io/valkey/blob/unstable/src/module.c#L7602-L7607) unless some contents are going to be saved to the RDB.
Looks like we don't create a context in the save path Let me follow up with a test change to catch this |
|
See #2150 for tests |
) See #2132 for the fix. This just ensures that we always create context in all branches of aux_load and aux_save Signed-off-by: Jacob Murphy <[email protected]>
…alkey-io#2132) When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes valkey-io#2125 Signed-off-by: Jacob Murphy <[email protected]>
…alkey-io#2132) When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes valkey-io#2125 Signed-off-by: Jacob Murphy <[email protected]> Signed-off-by: Harkrishn Patro <[email protected]>
…2132) When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes #2125 Signed-off-by: Jacob Murphy <[email protected]> Signed-off-by: Harkrishn Patro <[email protected]>
…2132) When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes #2125 Signed-off-by: Jacob Murphy <[email protected]> Signed-off-by: Harkrishn Patro <[email protected]>
…alkey-io#2132) When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes valkey-io#2125 Signed-off-by: Jacob Murphy <[email protected]> Signed-off-by: chzhoo <[email protected]>
…lkey-io#2150) See valkey-io#2132 for the fix. This just ensures that we always create context in all branches of aux_load and aux_save Signed-off-by: Jacob Murphy <[email protected]> Signed-off-by: chzhoo <[email protected]>
…alkey-io#2132) When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes valkey-io#2125 Signed-off-by: Jacob Murphy <[email protected]> (cherry picked from commit 258213f)
…alkey-io#2132) When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes valkey-io#2125 Signed-off-by: Jacob Murphy <[email protected]> (cherry picked from commit 258213f)
…alkey-io#2132) When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes valkey-io#2125 Signed-off-by: Jacob Murphy <[email protected]> Signed-off-by: shanwan1 <[email protected]>
…lkey-io#2150) See valkey-io#2132 for the fix. This just ensures that we always create context in all branches of aux_load and aux_save Signed-off-by: Jacob Murphy <[email protected]> Signed-off-by: shanwan1 <[email protected]>
…alkey-io#2132) When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes valkey-io#2125 Signed-off-by: Jacob Murphy <[email protected]>
…alkey-io#2132) When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes valkey-io#2125 Signed-off-by: Jacob Murphy <[email protected]>
…2132) When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes #2125 Signed-off-by: Jacob Murphy <[email protected]>
…alkey-io#2132) When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes valkey-io#2125 Signed-off-by: Jacob Murphy <[email protected]> (cherry picked from commit 258213f)
…alkey-io#2132) When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes valkey-io#2125 Signed-off-by: Jacob Murphy <[email protected]> (cherry picked from commit 258213f) Signed-off-by: Viktor Söderqvist <[email protected]>
…alkey-io#2132) When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes valkey-io#2125 Signed-off-by: Jacob Murphy <[email protected]> (cherry picked from commit 258213f) Signed-off-by: Viktor Söderqvist <[email protected]>
…2132) When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes #2125 Signed-off-by: Jacob Murphy <[email protected]> (cherry picked from commit 258213f) Signed-off-by: Viktor Söderqvist <[email protected]>
…alkey-io#2132) When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes valkey-io#2125 Signed-off-by: Jacob Murphy <[email protected]> (cherry picked from commit 258213f) Signed-off-by: Viktor Söderqvist <[email protected]>
When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback.
https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still.
Fixes #2125