1. 08 Aug, 2020 1 commit
    • Wang Yuan's avatar
      Fix applying zero offset to null pointer when creating moduleFreeContextReusedClient (#7323) · 1ef014ee
      Wang Yuan authored
      Before this fix we where attempting to select a db before creating db the DB, see: #7323
      
      This issue doesn't seem to have any implications, since the selected DB index is 0,
      the db pointer remains NULL, and will later be correctly set before using this dummy
      client for the first time.
      
      As we know, we call 'moduleInitModulesSystem()' before 'initServer()'. We will allocate
      memory for server.db in 'initServer', but we call 'createClient()' that will call 'selectDb()'
      in 'moduleInitModulesSystem()', before the databases where created. Instead, we should call
      'createClient()' for moduleFreeContextReusedClient after 'initServer()'.
      1ef014ee
  2. 29 Jul, 2020 1 commit
  3. 23 Jul, 2020 1 commit
  4. 16 Jul, 2020 1 commit
    • yoav-steinberg's avatar
      Support passing stack allocated module strings to moduleCreateArgvFromUserFormat (#7528) · d484b8a0
      yoav-steinberg authored
      Specifically, the key passed to the module aof_rewrite callback is a stack allocated robj. When passing it to RedisModule_EmitAOF (with appropriate "s" fmt string) redis used to panic when trying to inc the ref count of the stack allocated robj. Now support such robjs by coying them to a new heap robj. This doesn't affect performance because using the alternative "c" or "b" format strings also copies the input to a new heap robj.
      d484b8a0
  5. 15 Jul, 2020 1 commit
  6. 14 Jun, 2020 1 commit
    • meir@redislabs.com's avatar
      Fix RM_ScanKey module api not to return int encoded strings · a89bf734
      meir@redislabs.com authored
      The scan key module API provides the scan callback with the current
      field name and value (if it exists). Those arguments are RedisModuleString*
      which means it supposes to point to robj which is encoded as a string.
      Using createStringObjectFromLongLong function might return robj that
      points to an integer and so break a module that tries for example to
      use RedisModule_StringPtrLen on the given field/value.
      
      The PR introduces a fix that uses the createObject function and sdsfromlonglong function.
      Using those function promise that the field and value pass to the to the
      scan callback will be Strings.
      
      The PR also changes the Scan test module to use RedisModule_StringPtrLen
      to catch the issue. without this, the issue is hidden because
      RedisModule_ReplyWithString knows to handle integer encoding of the
      given robj (RedisModuleString).
      
      The PR also introduces a new test to verify the issue is solved.
      a89bf734
  7. 21 Apr, 2020 1 commit
  8. 02 Apr, 2020 1 commit
  9. 01 Apr, 2020 1 commit
    • Guy Benoish's avatar
      Fix memory corruption in moduleHandleBlockedClients · c4dc5b80
      Guy Benoish authored
      By using a "circular BRPOPLPUSH"-like scenario it was
      possible the get the same client on db->blocking_keys
      twice (See comment in moduleTryServeClientBlockedOnKey)
      
      The fix was actually already implememnted in
      moduleTryServeClientBlockedOnKey but it had a bug:
      the funxction should return 0 or 1 (not OK or ERR)
      
      Other changes:
      1. Added two commands to blockonkeys.c test module (To
         reproduce the case described above)
      2. Simplify blockonkeys.c in order to make testing easier
      3. cast raxSize() to avoid warning with format spec
      c4dc5b80
  10. 31 Mar, 2020 2 commits
  11. 23 Mar, 2020 1 commit
  12. 18 Mar, 2020 1 commit
  13. 28 Feb, 2020 2 commits
  14. 23 Feb, 2020 1 commit
  15. 22 Feb, 2020 2 commits
  16. 16 Feb, 2020 1 commit
  17. 10 Feb, 2020 1 commit
  18. 06 Feb, 2020 4 commits
    • Oran Agra's avatar
      add no-slowlog option to RM_CreateCommand · 46216b0e
      Oran Agra authored
      46216b0e
    • Oran Agra's avatar
      RM_Scan disable dict rehashing · 28ef18a8
      Oran Agra authored
      The callback approach we took is very efficient, the module can do any
      filtering of keys without building any list and cloning strings, it can
      also read data from the key's value. but if the user tries to re-open
      the key, or any other key, this can cause dict re-hashing (dictFind does
      that), and that's very bad to do from inside dictScan.
      
      this commit protects the dict from doing any rehashing during scan, but
      also warns the user not to attempt any writes or command calls from
      within the callback, for fear of unexpected side effects and crashes.
      28ef18a8
    • Oran Agra's avatar
      moduleRDBLoadError, add key name, and use panic rather than exit · 85cc696f
      Oran Agra authored
      using panic rather than exit means you get s stack trace of the code
      path that experianced the error, and possibly other info.
      85cc696f
    • Oran Agra's avatar
      Fix client flags to be int64 in module.c · d454d5a4
      Oran Agra authored
      currently there's no bug since the flags these functions handle are
      always lower than 32bit, but still better fix the type to prevent future
      bugs.
      d454d5a4
  19. 05 Feb, 2020 1 commit
  20. 04 Feb, 2020 1 commit
  21. 03 Feb, 2020 2 commits
  22. 30 Jan, 2020 1 commit
    • Guy Benoish's avatar
      ld2string should fail if string contains \0 in the middle · 2deb5551
      Guy Benoish authored
      This bug affected RM_StringToLongDouble and HINCRBYFLOAT.
      I added tests for both cases.
      
      Main changes:
      1. Fixed string2ld to fail if string contains \0 in the middle
      2. Use string2ld in getLongDoubleFromObject - No point of
         having duplicated code here
      
      The two changes above broke RM_SaveLongDouble/RM_LoadLongDouble
      because the long double string was saved with length+1 (An innocent
      mistake, but it's actually a bug - The length passed to
      RM_SaveLongDouble should not include the last \0).
      2deb5551
  23. 29 Jan, 2020 1 commit
  24. 30 Dec, 2019 1 commit
    • Guy Benoish's avatar
      Modules: Fix blocked-client-related memory leak · d7d13721
      Guy Benoish authored
      If a blocked module client times-out (or disconnects, unblocked
      by CLIENT command, etc.) we need to call moduleUnblockClient
      in order to free memory allocated by the module sub-system
      and blocked-client private data
      
      Other changes:
      Made blockedonkeys.tcl tests a bit more aggressive in order
      to smoke-out potential memory leaks
      d7d13721
  25. 23 Dec, 2019 2 commits
  26. 20 Dec, 2019 1 commit
  27. 18 Dec, 2019 3 commits
  28. 17 Dec, 2019 3 commits