1. 17 Dec, 2015 1 commit
    • antirez's avatar
      Fix a race that may lead to the active (slave) client to be freed. · d999f5a6
      antirez authored
      In issue #2948 a crash was reported in processCommand(). Later Oran Agra
      (@oranagra) traced the bug (in private chat) in the following sequence
      of events:
      
      1. Some maxmemory is set.
      2. The slave is the currently active client and is executing PING or
         REPLCONF or whatever a slave can send to its master.
      3. freeMemoryIfNeeded() is called since maxmemory is set.
      4. flushSlavesOutputBuffers() is called by freeMemoryIfNeeded().
      5. During slaves buffers flush, a write error could be encoutered in
         writeToClient() or sendReplyToClient() depending on the version of
         Redis. This will trigger freeClient() against the currently active
         client, so a segmentation fault will likely happen in
         processCommand() immediately after the call to freeMemoryIfNeeded().
      
      There are different possible fixes:
      
      1. Add flags to writeToClient() (recent versions code base) so that
         we can ignore the write errors, and use this flag in
         flushSlavesOutputBuffers(). However this is not simple to do in older
         versions of Redis.
      2. Use freeClientAsync() during write errors. This works but changes the
         current behavior of releasing clients ASAP when possible. Normally
         we write to clients during the normal event loop processing, in the
         writable client, where there is no active client, so no care must be
         taken.
      3. The fix of this commit: to detect that the current client is no
         longer valid. This fix is a bit "ad-hoc", but works across all the
         versions and has the advantage of not changing the remaining
         behavior. Only alters what happens during this race condition,
         hopefully.
      d999f5a6
  2. 15 Dec, 2015 1 commit
  3. 14 Dec, 2015 1 commit
  4. 13 Dec, 2015 8 commits
  5. 11 Dec, 2015 3 commits
  6. 10 Dec, 2015 5 commits
    • antirez's avatar
      Cluster: more reliable migration tests. · 5ad4f7e0
      antirez authored
      The old version was modeled with two failovers, however after the first
      it is possible that another slave will migrate to the new master, since
      for some time the new master is not backed by any slave. Probably there
      should be some pause after a failover, before the migration. Anyway the
      test is simpler in this way, and depends less on timing.
      5ad4f7e0
    • antirez's avatar
      Fix merge of cluster migrate-to flag. · 711bf140
      antirez authored
      711bf140
    • antirez's avatar
      Cluster: more reliable replicas migration test. · 6007ea3b
      antirez authored
      6007ea3b
    • antirez's avatar
      Remove debugging message left there for error. · 6d5d8d10
      antirez authored
      6d5d8d10
    • antirez's avatar
      Fix replicas migration by adding a new flag. · 2e43bcff
      antirez authored
      Some time ago I broken replicas migration (reported in #2924).
      The idea was to prevent masters without replicas from getting replicas
      because of replica migration, I remember it to create issues with tests,
      but there is no clue in the commit message about why it was so
      undesirable.
      
      However my patch as a side effect totally ruined the concept of replicas
      migration since we want it to work also for instances that, technically,
      never had slaves in the past: promoted slaves.
      
      So now instead the ability to be targeted by replicas migration, is a
      new flag "migrate-to". It only applies to masters, and is set in the
      following two cases:
      
      1. When a master gets a slave, it is set.
      2. When a slave turns into a master because of fail over, it is set.
      
      This way replicas migration targets are only masters that used to have
      slaves, and slaves of masters (that used to have slaves... obviously)
      and are promoted.
      
      The new flag is only internal, and is never exposed in the output nor
      persisted in the nodes configuration, since all the information to
      handle it are implicit in the cluster configuration we already have.
      2e43bcff
  7. 06 Dec, 2015 1 commit
  8. 27 Nov, 2015 3 commits
    • antirez's avatar
      Fix renamed define after merge. · 4f7d1e46
      antirez authored
      4f7d1e46
    • antirez's avatar
      Handle wait3() errors. · 3626699f
      antirez authored
      My guess was that wait3() with WNOHANG could never return -1 and an
      error. However issue #2897 may possibly indicate that this could happen
      under non clear conditions. While we try to understand this better,
      better to handle a return value of -1 explicitly, otherwise in the
      case a BGREWRITE is in progress but wait3() returns -1, the effect is to
      match the first branch of the if/else block since server.rdb_child_pid
      is -1, and call backgroundSaveDoneHandler() without a good reason, that
      will, in turn, crash the Redis server with an assertion.
      3626699f
    • antirez's avatar
  9. 17 Nov, 2015 3 commits
  10. 09 Nov, 2015 1 commit
  11. 27 Oct, 2015 1 commit
  12. 15 Oct, 2015 10 commits
  13. 30 Sep, 2015 1 commit
    • antirez's avatar
      redis-cli pipe mode: don't stay in the write loop forever. · 30978004
      antirez authored
      The code was broken and resulted in redis-cli --pipe to, most of the
      times, writing everything received in the standard input to the Redis
      connection socket without ever reading back the replies, until all the
      content to write was written.
      
      This means that Redis had to accumulate all the output in the output
      buffers of the client, consuming a lot of memory.
      
      Fixed thanks to the original report of anomalies in the behavior
      provided by Twitter user @fsaintjacques.
      30978004
  14. 15 Sep, 2015 1 commit
    • antirez's avatar
      Test: fix false positive in HSTRLEN test. · 652e662d
      antirez authored
      HINCRBY* tests later used the value "tmp" that was sometimes generated
      by the random key generation function. The result was ovewriting what
      Tcl expected to be inside Redis with another value, causing the next
      HSTRLEN test to fail.
      652e662d