Skip to content

Update test cases for sentinel#12

Merged
hwware merged 4 commits intounstablefrom
sentinel_test_times
Aug 24, 2021
Merged

Update test cases for sentinel#12
hwware merged 4 commits intounstablefrom
sentinel_test_times

Conversation

@hwware
Copy link
Owner

@hwware hwware commented Aug 24, 2021

Used the sentinel debug command to reduce the overall time it takes for sentinel test cases to run.
Test time reduced from 3 minutes to 1 minute 40 seconds in local environment.

PR:

redis#9408

S $id sentinel debug default-down-after 1000
S $id sentinel debug publish-period 100
set len [llength [S $id SENTINEL REPLICAS mymaster]]
wait_for_condition 40 500 {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we already decease info-period to 0.1 second, if wait_for_condition parameter could be decreased?

S $::alive_sentinel sentinel debug ping-period 100
S $::alive_sentinel sentinel debug ask-period 100
S $::alive_sentinel sentinel debug publish-period 100
wait_for_condition 1000 50 {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as below comments

S $::alive_sentinel sentinel debug ping-period 100
S $::alive_sentinel sentinel debug ask-period 100
S $::alive_sentinel sentinel debug publish-period 100
wait_for_condition 1000 50 {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as below comments

@hwware hwware merged commit a2b11c9 into unstable Aug 24, 2021
hwware added a commit that referenced this pull request Sep 1, 2021
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Sep 13, 2021
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Sep 15, 2021
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Sep 15, 2021
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Oct 13, 2021
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Oct 13, 2021
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Oct 13, 2021
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Oct 13, 2021
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Oct 25, 2021
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Oct 25, 2021
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Nov 2, 2021
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Nov 2, 2021
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Nov 2, 2021
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Nov 2, 2021
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Nov 16, 2021
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Nov 16, 2021
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Nov 16, 2021
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Nov 16, 2021
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Nov 18, 2021
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Nov 18, 2021
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Nov 18, 2021
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Nov 18, 2021
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Jan 6, 2022
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Jan 6, 2022
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Jan 6, 2022
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Jan 6, 2022
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Jan 6, 2022
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Jan 6, 2022
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Jan 6, 2022
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Jan 6, 2022
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Mar 24, 2022
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Mar 24, 2022
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Mar 24, 2022
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Apr 1, 2022
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Apr 1, 2022
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Apr 1, 2022
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Apr 1, 2022
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Apr 1, 2022
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Apr 1, 2022
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware added a commit that referenced this pull request Apr 1, 2022
* Update test cases for sentinel (#12)

* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl

* Update 07-down-conditions.tcl

* Update ci.yml

* Update ci.yml

* Update to test 7 and ci

* Update 07-down-conditions.tcl

* Delete 07-down-conditions.tcl

* Create 07-down-conditions.tcl

* Update 07-down-conditions.tcl
hwware added a commit that referenced this pull request Apr 1, 2022
* Update test cases

* Minor changes

* Update 05-manual.tcl

* Update 10-replica-priority.tcl
hwware pushed a commit that referenced this pull request Apr 5, 2024
fix some issues that come from sanitizer thread report.

1. when the main thread is updating daylight_active, other threads (bio,
module thread) may be writing logs at the same time.
```
WARNING: ThreadSanitizer: data race (pid=661064)
  Read of size 4 at 0x55c9a4d11c70 by thread T2:
    #0 serverLogRaw /home/sundb/data/redis_fork/src/server.c:116 (redis-server+0x8d797) (BuildId: dca0b1945ba30010e36129bdb296e488dd2b32d0)
    #1 _serverLog.constprop.2 /home/sundb/data/redis_fork/src/server.c:146 (redis-server+0x2a3b14) (BuildId: dca0b1945ba30010e36129bdb296e488dd2b32d0)
    #2 bioProcessBackgroundJobs /home/sundb/data/redis_fork/src/bio.c:329 (redis-server+0x1c24ca) (BuildId: dca0b1945ba30010e36129bdb296e488dd2b32d0)

  Previous write of size 4 at 0x55c9a4d11c70 by main thread (mutexes: write M0, write M1, write M2, write M3):
    #0 updateCachedTimeWithUs /home/sundb/data/redis_fork/src/server.c:1102 (redis-server+0x925e7) (BuildId: dca0b1945ba30010e36129bdb296e488dd2b32d0)
    #1 updateCachedTimeWithUs /home/sundb/data/redis_fork/src/server.c:1087 (redis-server+0x925e7)
    #2 updateCachedTime /home/sundb/data/redis_fork/src/server.c:1118 (redis-server+0x925e7)
    #3 afterSleep /home/sundb/data/redis_fork/src/server.c:1811 (redis-server+0x925e7)
    #4 aeProcessEvents /home/sundb/data/redis_fork/src/ae.c:389 (redis-server+0x85ae0) (BuildId: dca0b1945ba30010e36129bdb296e488dd2b32d0)
    #5 aeProcessEvents /home/sundb/data/redis_fork/src/ae.c:342 (redis-server+0x85ae0)
    #6 aeMain /home/sundb/data/redis_fork/src/ae.c:477 (redis-server+0x85ae0)
    #7 main /home/sundb/data/redis_fork/src/server.c:7211 (redis-server+0x7168c) (BuildId: dca0b1945ba30010e36129bdb296e488dd2b32d0)
```

2. thread leaks in module tests
```
WARNING: ThreadSanitizer: thread leak (pid=668683)
  Thread T13 (tid=670041, finished) created by main thread at:
    #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:1036 (libtsan.so.2+0x3d179) (BuildId: 28a9f70061dbb2dfa2cef661d3b23aff4ea13536)
    #1 HelloBlockNoTracking_RedisCommand /home/sundb/data/redis_fork/tests/modules/blockonbackground.c:200 (blockonbackground.so+0x97fd) (BuildId: 9cd187906c57e88cdf896d121d1d96448b37a136)
    #2 HelloBlockNoTracking_RedisCommand /home/sundb/data/redis_fork/tests/modules/blockonbackground.c:169 (blockonbackground.so+0x97fd)
    #3 call /home/sundb/data/redis_fork/src/server.c:3546 (redis-server+0x9b7fb) (BuildId: dca0b1945ba30010e36129bdb296e488dd2b32d0)
    #4 processCommand /home/sundb/data/redis_fork/src/server.c:4176 (redis-server+0xa091c) (BuildId: dca0b1945ba30010e36129bdb296e488dd2b32d0)
    #5 processCommandAndResetClient /home/sundb/data/redis_fork/src/networking.c:2468 (redis-server+0xd2b8e) (BuildId: dca0b1945ba30010e36129bdb296e488dd2b32d0)
    #6 processInputBuffer /home/sundb/data/redis_fork/src/networking.c:2576 (redis-server+0xd2b8e)
    #7 readQueryFromClient /home/sundb/data/redis_fork/src/networking.c:2722 (redis-server+0xd358f) (BuildId: dca0b1945ba30010e36129bdb296e488dd2b32d0)
    #8 callHandler /home/sundb/data/redis_fork/src/connhelpers.h:58 (redis-server+0x288a7b) (BuildId: dca0b1945ba30010e36129bdb296e488dd2b32d0)
    #9 connSocketEventHandler /home/sundb/data/redis_fork/src/socket.c:277 (redis-server+0x288a7b)
    #10 aeProcessEvents /home/sundb/data/redis_fork/src/ae.c:417 (redis-server+0x85b45) (BuildId: dca0b1945ba30010e36129bdb296e488dd2b32d0)
    #11 aeProcessEvents /home/sundb/data/redis_fork/src/ae.c:342 (redis-server+0x85b45)
    #12 aeMain /home/sundb/data/redis_fork/src/ae.c:477 (redis-server+0x85b45)
    #13 main /home/sundb/data/redis_fork/src/server.c:7211 (redis-server+0x7168c) (BuildId: dca0b1945ba30010e36129bdb296e488dd2b32d0)
```
hwware pushed a commit that referenced this pull request Aug 25, 2025
redis#14072)

Compiled Redis with COVERAGE_TEST, while using the fork API encountered
the following issue:
- Forked process calls `RedisModule_ExitFromChild` - child process
starts to report its COW while performing IO operations
- Parent process terminates child process with
`RedisModule_KillForkChild`
- Child process signal handler gets called while an IO operation is
called
- exit() is called because COVERAGE_TEST was on during compilation.
- exit() tries to perform more IO operations in its exit handlers.
- process gets deadlocked

Backtrace snippet:
```
#0  futex_wait (private=0, expected=2, futex_word=0x7e1220000c50) at ../sysdeps/nptl/futex-internal.h:146
#1  __GI___lll_lock_wait_private (futex=0x7e1220000c50) at ./nptl/lowlevellock.c:34
#2  0x00007e1234696429 in __GI__IO_flush_all () at ./libio/genops.c:698
#3  0x00007e123469680d in _IO_cleanup () at ./libio/genops.c:843
#4  0x00007e1234647b74 in __run_exit_handlers (status=status@entry=255, listp=<optimized out>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at ./stdlib/exit.c:129
#5  0x00007e1234647bbe in __GI_exit (status=status@entry=255) at ./stdlib/exit.c:138
#6  0x00005ef753264e13 in exitFromChild (retcode=255) at /home/jonathan/CLionProjects/redis/src/server.c:263
#7  sigKillChildHandler (sig=<optimized out>) at /home/jonathan/CLionProjects/redis/src/server.c:6794
#8  <signal handler called>
#9  0x00007e1234685b94 in _IO_fgets (buf=buf@entry=0x7e122dafdd90 "KSM:", ' ' <repeats 19 times>, "0 kB\n", n=n@entry=1024, fp=fp@entry=0x7e1220000b70) at ./libio/iofgets.c:47
#10 0x00005ef75326c5e0 in fgets (__stream=<optimized out>, __n=<optimized out>, __s=<optimized out>, __s=<optimized out>, __n=<optimized out>, __stream=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/stdio2.h:200
#11 zmalloc_get_smap_bytes_by_field (field=0x5ef7534c42fd "Private_Dirty:", pid=<optimized out>) at /home/jonathan/CLionProjects/redis/src/zmalloc.c:928
#12 0x00005ef75338ab1f in zmalloc_get_private_dirty (pid=-1) at /home/jonathan/CLionProjects/redis/src/zmalloc.c:978
#13 sendChildInfoGeneric (info_type=CHILD_INFO_TYPE_MODULE_COW_SIZE, keys=0, progress=-1, pname=0x5ef7534c95b2 "Module fork") at /home/jonathan/CLionProjects/redis/src/childinfo.c:71
#14 0x00005ef75337962c in sendChildCowInfo (pname=0x5ef7534c95b2 "Module fork", info_type=CHILD_INFO_TYPE_MODULE_COW_SIZE) at /home/jonathan/CLionProjects/redis/src/server.c:6895
#15 RM_ExitFromChild (retcode=0) at /home/jonathan/CLionProjects/redis/src/module.c:11468
```

Change is to make the exit() _exit() calls conditional based on a
parameter to exitFromChild function.
The signal handler should exit without io operations since it doesn't
know its history.(If we were in the middle of IO operations before it
was called)

---------

Co-authored-by: Yuan Wang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant