9347 Commits

Author SHA1 Message Date
Oran Agra
8f0c339892 tests: each test client work on a distinct port range
apparently when running tests in parallel (the default of --clients 16),
there's a chance for two tests to use the same port.
specifically, one test might shutdown a master and still have the
replica up, and then another test will re-use the port number of master
for another master, and then that replica will connect to the master of
the other test.

this can cause a master to count too many full syncs and fail a test if
we run the tests with --single integration/psync2 --loop --stop

see Probmem 2 in #7314
2020-05-26 11:17:08 +03:00
Salvatore Sanfilippo
07cdd478b3 Merge pull request #7315 from oranagra/ci-32bit
add CI for 32bit build
2020-05-24 09:50:04 +02:00
Oran Agra
c41e04bf41 add CI for 32bit build 2020-05-24 09:35:45 +03:00
antirez
7f994abc48 Make disconnectSlaves() synchronous in the base case.
Otherwise we run into that:

Backtrace:
src/redis-server 127.0.0.1:21322(logStackTrace+0x45)[0x479035]
src/redis-server 127.0.0.1:21322(sigsegvHandler+0xb9)[0x4797f9]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7fd373c5e390]
src/redis-server 127.0.0.1:21322(_serverAssert+0x6a)[0x47660a]
src/redis-server 127.0.0.1:21322(freeReplicationBacklog+0x42)[0x451282]
src/redis-server 127.0.0.1:21322[0x4552d4]
src/redis-server 127.0.0.1:21322[0x4c5593]
src/redis-server 127.0.0.1:21322(aeProcessEvents+0x2e6)[0x42e786]
src/redis-server 127.0.0.1:21322(aeMain+0x1d)[0x42eb0d]
src/redis-server 127.0.0.1:21322(main+0x4c5)[0x42b145]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fd3738a3830]
src/redis-server 127.0.0.1:21322(_start+0x29)[0x42b409]

Since we disconnect all the replicas and free the replication backlog in
certain replication paths, and the code that will free the replication
backlog expects that no replica is connected.

However we still need to free the replicas asynchronously in certain
cases, as documented in the top comment of disconnectSlaves().
2020-05-22 19:29:09 +02:00
antirez
8ecf2998ca Merge branch 'unstable' of github.com:/antirez/redis into unstable 2020-05-22 16:31:05 +02:00
antirez
ba7f0b7719 Fix #7306 less aggressively.
Citing from the issue:

btw I suggest we change this fix to something else:
* We revert the fix.
* We add a call that disconnects chained replicas in the place where we trim the replica (that is a master i this case) offset.
This way we can avoid disconnections when there is no trimming of the backlog.

Note that we now want to disconnect replicas asynchronously in
disconnectSlaves(), because it's in general safer now that we can call
it from freeClient(). Otherwise for instance the command:

    CLIENT KILL TYPE master

May crash: clientCommand() starts running the linked of of clients,
looking for clients to kill. However it finds the master, kills it
calling freeClient(), but this in turn calls replicationCacheMaster()
that may also call disconnectSlaves() now. So the linked list iterator
of the clientCommand() will no longer be valid.
2020-05-22 16:29:53 +02:00
Salvatore Sanfilippo
42afb7e635 Merge pull request #7096 from ShooterIT/sendfile
Implements sendfile for redis.
2020-05-22 13:55:46 +02:00
Salvatore Sanfilippo
51f840fd47 Merge pull request #7305 from madolson/unstable-connection
EAGAIN not handled for TLS during diskless load
2020-05-22 12:25:40 +02:00
Salvatore Sanfilippo
a688552350 Merge pull request #7306 from QuChen88/chained-replica-offset
Disconnect chained replicas when the replica performs PSYNC with the master always to avoid replication offset mismatch between master and chained replicas
2020-05-22 12:23:07 +02:00
Qu Chen
7de04d4d36 Disconnect chained replicas when the replica performs PSYNC with the master always to avoid replication offset mismatch between master and chained replicas. 2020-05-21 18:42:10 -07:00
Madelyn Olson
5d6f9cd3b1 EAGAIN for tls during diskless load 2020-05-21 15:20:59 -07:00
Salvatore Sanfilippo
a7d4f5f144 Merge pull request #7304 from hwware/lcs_fix
fix server crash for STRALGO command
2020-05-22 00:18:27 +02:00
hwware
7c87d86aef using moreargs variable 2020-05-21 18:13:35 -04:00
hwware
c4776244f8 fix server crash for STRALGO command 2020-05-21 17:30:36 -04:00
Salvatore Sanfilippo
5c4a67882a Merge pull request #7300 from ShooterIT/comment
Replace 'addDeferredMultiBulkLength' with 'addReplyDeferredLen' in comment
2020-05-21 15:53:01 +02:00
Salvatore Sanfilippo
5746b71485 Merge pull request #7288 from yossigo/tls-protocols-redis-conf-example
TLS: Improve tls-protocols clarity in redis.conf.
2020-05-21 15:49:37 +02:00
Salvatore Sanfilippo
a1bda4a393 Merge pull request #7299 from ShooterIT/reply-bytes
Fix reply bytes calculation error on 32bit platform
2020-05-21 15:47:15 +02:00
ShooterIT
fbe0c03030 Replace addDeferredMultiBulkLength with addReplyDeferredLen in comment 2020-05-21 21:45:35 +08:00
ShooterIT
9c0aa1a95b Fix reply bytes calculation error
Fix #7275.
2020-05-21 21:00:30 +08:00
Salvatore Sanfilippo
f38d0ec966 Merge pull request #7296 from soloestoy/tracking-broken-redir
Tracking: flag CLIENT_TRACKING_BROKEN_REDIR when redir broken
2020-05-21 09:26:12 +02:00
zhaozhao.zz
4a93049285 Tracking: flag CLIENT_TRACKING_BROKEN_REDIR when redir broken 2020-05-21 13:57:29 +08:00
Salvatore Sanfilippo
f0d8484f82 Merge pull request #7289 from oranagra/defrag_edge_case
fix a rare active defrag edge case bug leading to stagnation
2020-05-20 15:17:02 +02:00
Oran Agra
86b1b2e138 fix a rare active defrag edge case bug leading to stagnation
There's a rare case which leads to stagnation in the defragger, causing
it to keep scanning the keyspace and do nothing (not moving any
allocation), this happens when all the allocator slabs of a certain bin
have the same % utilization, but the slab from which new allocations are
made have a lower utilization.

this commit fixes it by removing the current slab from the overall
average utilization of the bin, and also eliminate any precision loss in
the utilization calculation and move the decision about the defrag to
reside inside jemalloc.

and also add a test that consistently reproduce this issue.
2020-05-20 16:04:42 +03:00
Yossi Gottlieb
5c82140f66 TLS: Improve tls-protocols clarity in redis.conf. 2020-05-20 15:14:23 +03:00
Oran Agra
444af0145e improve DEBUG MALLCTL to be able to write to write only fields.
also support:
  debug mallctl-str thread.tcache.flush VOID
2020-05-20 14:09:22 +03:00
Salvatore Sanfilippo
a5268a21bc Merge pull request #7276 from hujiecs/fix-clear-all-command-flag-in-acl
fix clear USER_FLAG_ALLCOMMANDS flag in acl
2020-05-19 16:19:28 +02:00
Salvatore Sanfilippo
83521eb832 Merge pull request #7196 from ShooterIT/benchmark
Redis Benchmark: make test data better
2020-05-19 16:16:38 +02:00
Salvatore Sanfilippo
39dca920f6 Merge pull request #7279 from hwware/benchmark_leak_fix
Redis-Benchmark: avoid potentical memmory leaking
2020-05-19 16:14:30 +02:00
Salvatore Sanfilippo
1281ca2947 Merge pull request #7232 from trevor211/handleHashTagWhenComputingHashSlot
Tcl client support hash tagged keys.
2020-05-19 09:23:44 +02:00
hwware
2b4f14387e Redis-Benchmark: avoid potentical memmory leaking 2020-05-18 22:10:57 -04:00
hujie
66214e3713 fix clear USER_FLAG_ALLCOMMANDS flag in acl
in ACLSetUserCommandBit, when the command bit overflows, no operation
is performed, so no need clear the USER_FLAG_ALLCOMMANDS flag.

in ACLSetUser, when adding subcommand, we don't need to call
ACLGetCommandID ahead since subcommand may be empty.
2020-05-19 00:58:58 +08:00
ShooterIT
16c95dce51 Redis Benchmark: generate random test data
The function of generating random data is designed by antirez. See #7196.
2020-05-18 18:18:27 +08:00
Salvatore Sanfilippo
2b5759908a Merge pull request #7252 from ShooterIT/dictsize
Use dictSize to get the size of dict in dict.c
2020-05-18 10:33:08 +02:00
Salvatore Sanfilippo
4771af6a76 Merge pull request #7255 from madolson/dev-unstable-converge-hash-validation
Converge hash validation for adding and removing
2020-05-18 10:31:47 +02:00
Salvatore Sanfilippo
5c6631d941 Merge pull request #7247 from bsergean/patch-3
Redis-cli 6.0.1 `--cluster-yes` doesn't work (fix #7246)
2020-05-18 10:23:54 +02:00
Salvatore Sanfilippo
187d21c592 Merge pull request #7271 from oranagra/fix_valgrind_repl_test
fix valgrind test failure in replication test
2020-05-18 10:09:39 +02:00
Oran Agra
7c88eca1e6 fix valgrind test failure in replication test
in 00323f342 i added more keys to that test to make it run longer
but in valgrind this now means the test times out, give valgrind more
time.
2020-05-18 10:26:53 +03:00
antirez
857bf0b4b9 Merge branch 'unstable' of github.com:/antirez/redis into unstable 2020-05-17 18:24:48 +02:00
antirez
5781712458 Improve the PSYNC2 test reliability. 2020-05-17 18:24:34 +02:00
Salvatore Sanfilippo
3eac39fa96 Merge pull request #7264 from oranagra/test_for_7205
add regression test for the race in #7205
2020-05-17 17:59:14 +02:00
Oran Agra
ba6f40ea94 add regression test for the race in #7205
with the original version of 6.0.0, this test detects an excessive full
sync.
with the fix in 146201c69, this test detects memory corruption,
especially when using libc allocator with or without valgrind.
2020-05-17 18:26:02 +03:00
antirez
492bbefdb0 Remove the client from CLOSE_ASAP list before caching the master.
This was broken in 146201c: we identified a crash in the CI, what
was happening before the fix should be like that:

1. The client gets in the async free list.
2. However freeClient() gets called again against the same client
   which is a master.
3. The client arrived in freeClient() with the CLOSE_ASAP flag set.
4. The master gets cached, but NOT removed from the CLOSE_ASAP linked
   list.
5. The master client that was cached was immediately removed since it
   was still in the list.
6. Redis accessed a freed cached master.

This is how the crash looked like:

=== REDIS BUG REPORT START: Cut & paste starting from here ===
1092:S 16 May 2020 11:44:09.731 # Redis 999.999.999 crashed by signal: 11
1092:S 16 May 2020 11:44:09.731 # Crashed running the instruction at: 0x447e18
1092:S 16 May 2020 11:44:09.731 # Accessing address: 0xffffffffffffffff
1092:S 16 May 2020 11:44:09.731 # Failed assertion:  (:0)

------ STACK TRACE ------
EIP:
src/redis-server 127.0.0.1:21300(readQueryFromClient+0x48)[0x447e18]

And the 0xffff address access likely comes from accessing an SDS that is
set to NULL (we go -1 offset to read the header).
2020-05-16 17:15:35 +02:00
antirez
bf6bf4e8de Merge branch 'unstable' of github.com:/antirez/redis into unstable 2020-05-15 10:21:51 +02:00
antirez
146201c694 Cache master without checking of deferred close flags.
The context is issue #7205: since the introduction of threaded I/O we close
clients asynchronously by default from readQueryFromClient(). So we
should no longer prevent the caching of the master client, to later
PSYNC incrementally, if such flags are set. However we also don't want
the master client to be cached with such flags (would be closed
immediately after being restored). And yet we want a way to understand
if a master was closed because of a protocol error, and in that case
prevent the caching.
2020-05-15 10:19:13 +02:00
Benjamin Sergeant
4bbf07dbbb do not handle --cluster-yes for cluster fix mode 2020-05-14 15:29:06 -07:00
Madelyn Olson
4e8d141cba Converge hash validation for adding and removing 2020-05-14 11:07:51 -07:00
Salvatore Sanfilippo
3c8824aa54 Merge pull request #7229 from yossigo/tls-fails-on-recent-debian
TLS: Fix test failures on recent Debian/Ubuntu.
2020-05-14 18:15:17 +02:00
Salvatore Sanfilippo
3a52c1c0ec Merge pull request #7230 from yossigo/tls-crypto-locks
TLS: Add crypto locks for older OpenSSL support.
2020-05-14 18:14:49 +02:00
Salvatore Sanfilippo
cff2fcb7c6 Merge pull request #7244 from devnexen/netbsd_build_fix
NetBSD build update.
2020-05-14 18:14:06 +02:00
Salvatore Sanfilippo
4932dd7fc3 Merge pull request #7253 from madolson/unstable-ae-recursion
Added a refcount on timer events to prevent deletion of recursive timer events
2020-05-14 18:10:57 +02:00