-
Notifications
You must be signed in to change notification settings - Fork 922
Free module context even if there was no content written in auxsave2 #2132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Free module context even if there was no content written in auxsave2 #2132
Conversation
Signed-off-by: Jacob Murphy <jkmurphy@google.com>
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense to me.
@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 https://github.com/valkey-io/valkey/blob/8.1.1/tests/modules/testrdb.c#L97-L116 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 <jkmurphy@google.com>
…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 <jkmurphy@google.com>
…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 <jkmurphy@google.com> Signed-off-by: Harkrishn Patro <harkrisp@amazon.com>
…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 <jkmurphy@google.com> Signed-off-by: Harkrishn Patro <harkrisp@amazon.com>
…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 <jkmurphy@google.com> Signed-off-by: Harkrishn Patro <harkrisp@amazon.com>
…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 <jkmurphy@google.com> Signed-off-by: chzhoo <czawyx@163.com>
…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 <jkmurphy@google.com> Signed-off-by: chzhoo <czawyx@163.com>
…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 <jkmurphy@google.com> (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 <jkmurphy@google.com> (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 <jkmurphy@google.com> Signed-off-by: shanwan1 <shanwan1@intel.com>
…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 <jkmurphy@google.com> Signed-off-by: shanwan1 <shanwan1@intel.com>
…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 <jkmurphy@google.com>
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