1. 13 Apr, 2017 1 commit
  2. 12 Apr, 2017 2 commits
  3. 11 Apr, 2017 5 commits
  4. 10 Apr, 2017 3 commits
    • antirez's avatar
      Make more obvious why there was issue #3843. · 531647bb
      antirez authored
      531647bb
    • Salvatore Sanfilippo's avatar
      Merge pull request #3843 from dvirsky/fix_bc_free · 01b6966a
      Salvatore Sanfilippo authored
      fixed free of blocked client before refering to it
      01b6966a
    • antirez's avatar
      Fix modules blocking commands awake delay. · ffefc9f9
      antirez authored
      If a thread unblocks a client blocked in a module command, by using the
      RedisMdoule_UnblockClient() API, the event loop may not be awaken until
      the next timeout of the multiplexing API or the next unrelated I/O
      operation on other clients. We actually want the client to be served
      ASAP, so a mechanism is needed in order for the unblocking API to inform
      Redis that there is a client to serve ASAP.
      
      This commit fixes the issue using the old trick of the pipe: when a
      client needs to be unblocked, a byte is written in a pipe. When we run
      the list of clients blocked in modules, we consume all the bytes
      written in the pipe. Writes and reads are performed inside the context
      of the mutex, so no race is possible in which we consume the bytes that
      are actually related to an awake request for a client that should still
      be put into the list of clients to unblock.
      
      It was verified that after the fix the server handles the blocked
      clients with the expected short delay.
      
      Thanks to @dvirsky for understanding there was such a problem and
      reporting it.
      ffefc9f9
  5. 08 Apr, 2017 2 commits
  6. 07 Apr, 2017 1 commit
  7. 27 Mar, 2017 1 commit
  8. 15 Mar, 2017 2 commits
  9. 09 Mar, 2017 1 commit
  10. 01 Mar, 2017 1 commit
  11. 23 Feb, 2017 4 commits
  12. 22 Feb, 2017 3 commits
  13. 21 Feb, 2017 4 commits
    • antirez's avatar
      Merge branch 'siphash' into unstable · 06263485
      antirez authored
      06263485
    • antirez's avatar
      Merge branch 'arm' into unstable · e084b5a3
      antirez authored
      e084b5a3
    • antirez's avatar
      SipHash 2-4 -> SipHash 1-2. · 0285c271
      antirez authored
      For performance reasons we use a reduced rounds variant of
      SipHash. This should still provide enough protection and the
      effects in the hash table distribution are non existing.
      If some real world attack on SipHash 1-2 will be found we can
      trivially switch to something more secure. Anyway it is a
      big step forward from Murmurhash, for which it is trivial to
      generate *seed independent* colliding keys... The speed
      penatly introduced by SipHash 2-4, around 4%, was a too big
      price to pay compared to the effectiveness of the HashDoS
      attack against SipHash 1-2, and considering so far in the
      Redis history, no such an incident ever happened even while
      using trivially to collide hash functions.
      0285c271
    • antirez's avatar
      freeMemoryIfNeeded(): improve code and lazyfree handling. · cd90389b
      antirez authored
      1. Refactor memory overhead computation into a function.
      2. Every 10 keys evicted, check if memory usage already reached
         the target value directly, since we otherwise don't count all
         the memory reclaimed by the background thread right now.
      cd90389b
  14. 20 Feb, 2017 5 commits
    • antirez's avatar
      84fa8230
    • antirez's avatar
      SipHash x86 optimizations. · 05ea8c61
      antirez authored
      05ea8c61
    • antirez's avatar
      Use SipHash hash function to mitigate HashDos attempts. · adeed29a
      antirez authored
      This change attempts to switch to an hash function which mitigates
      the effects of the HashDoS attack (denial of service attack trying
      to force data structures to worst case behavior) while at the same time
      providing Redis with an hash function that does not expect the input
      data to be word aligned, a condition no longer true now that sds.c
      strings have a varialbe length header.
      
      Note that it is possible sometimes that even using an hash function
      for which collisions cannot be generated without knowing the seed,
      special implementation details or the exposure of the seed in an
      indirect way (for example the ability to add elements to a Set and
      check the return in which Redis returns them with SMEMBERS) may
      make the attacker's life simpler in the process of trying to guess
      the correct seed, however the next step would be to switch to a
      log(N) data structure when too many items in a single bucket are
      detected: this seems like an overkill in the case of Redis.
      
      SPEED REGRESION TESTS:
      
      In order to verify that switching from MurmurHash to SipHash had
      no impact on speed, a set of benchmarks involving fast insertion
      of 5 million of keys were performed.
      
      The result shows Redis with SipHash in high pipelining conditions
      to be about 4% slower compared to using the previous hash function.
      However this could partially be related to the fact that the current
      implementation does not attempt to hash whole words at a time but
      reads single bytes, in order to have an output which is endian-netural
      and at the same time working on systems where unaligned memory accesses
      are a problem.
      
      Further X86 specific optimizations should be tested, the function
      may easily get at the same level of MurMurHash2 if a few optimizations
      are performed.
      adeed29a
    • John.Koepi's avatar
    • antirez's avatar
      Don't leak file descriptor on syncWithMaster(). · 76d87f47
      antirez authored
      Close #3804.
      76d87f47
  15. 19 Feb, 2017 4 commits
  16. 09 Feb, 2017 1 commit
    • antirez's avatar
      Fix MIGRATE closing of cached socket on error. · f917e0da
      antirez authored
      After investigating issue #3796, it was discovered that MIGRATE
      could call migrateCloseSocket() after the original MIGRATE c->argv
      was already rewritten as a DEL operation. As a result the host/port
      passed to migrateCloseSocket() could be anything, often a NULL pointer
      that gets deferenced crashing the server.
      
      Now the socket is closed at an earlier time when there is a socket
      error in a later stage where no retry will be performed, before we
      rewrite the argument vector. Moreover a check was added so that later,
      in the socket_err label, there is no further attempt at closing the
      socket if the argument was rewritten.
      
      This fix should resolve the bug reported in #3796.
      f917e0da