Skip to content

Commit 3d3861d

Browse files
oranagraantirez
authored andcommitted
add daily github actions with libc malloc and valgrind
* fix memlry leaks with diskless replica short read. * fix a few timing issues with valgrind runs * fix issue with valgrind and watchdog schedule signal about the valgrind WD issue: the stack trace test in logging.tcl, has issues with valgrind: ==28808== Can't extend stack to 0x1ffeffdb38 during signal delivery for thread 1: ==28808== too small or bad protection modes it seems to be some valgrind bug with SA_ONSTACK. SA_ONSTACK seems unneeded since WD is not recursive (SA_NODEFER was removed), also, not sure if it's even valid without a call to sigaltstack()
1 parent 47ff136 commit 3d3861d

File tree

5 files changed

+106
-18
lines changed

5 files changed

+106
-18
lines changed

.github/workflows/daily.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Daily
2+
3+
on:
4+
schedule:
5+
- cron: '0 7 * * *'
6+
7+
jobs:
8+
test-jemalloc:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 1200
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: make
14+
run: make
15+
- name: test
16+
run: |
17+
sudo apt-get install tcl8.5
18+
./runtest --accurate --verbose
19+
- name: module api test
20+
run: ./runtest-moduleapi --verbose
21+
22+
test-libc-malloc:
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 1200
25+
steps:
26+
- uses: actions/checkout@v1
27+
- name: make
28+
run: make MALLOC=libc
29+
- name: test
30+
run: |
31+
sudo apt-get install tcl8.5
32+
./runtest --accurate --verbose
33+
- name: module api test
34+
run: ./runtest-moduleapi --verbose
35+
36+
test-valgrind:
37+
runs-on: ubuntu-latest
38+
timeout-minutes: 14400
39+
steps:
40+
- uses: actions/checkout@v1
41+
- name: make
42+
run: make valgrind
43+
- name: test
44+
run: |
45+
sudo apt-get install tcl8.5 valgrind -y
46+
./runtest --valgrind --verbose --clients 1
47+
- name: module api test
48+
run: ./runtest-moduleapi --valgrind --verbose --clients 1

src/debug.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@ void enableWatchdog(int period) {
16361636
/* Watchdog was actually disabled, so we have to setup the signal
16371637
* handler. */
16381638
sigemptyset(&act.sa_mask);
1639-
act.sa_flags = SA_ONSTACK | SA_SIGINFO;
1639+
act.sa_flags = SA_SIGINFO;
16401640
act.sa_sigaction = watchdogSignalHandler;
16411641
sigaction(SIGALRM, &act, NULL);
16421642
}

src/rdb.c

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,10 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key) {
14411441

14421442
/* Load every single element of the list */
14431443
while(len--) {
1444-
if ((ele = rdbLoadEncodedStringObject(rdb)) == NULL) return NULL;
1444+
if ((ele = rdbLoadEncodedStringObject(rdb)) == NULL) {
1445+
decrRefCount(o);
1446+
return NULL;
1447+
}
14451448
dec = getDecodedObject(ele);
14461449
size_t len = sdslen(dec->ptr);
14471450
quicklistPushTail(o->ptr, dec->ptr, len);
@@ -1468,8 +1471,10 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key) {
14681471
long long llval;
14691472
sds sdsele;
14701473

1471-
if ((sdsele = rdbGenericLoadStringObject(rdb,RDB_LOAD_SDS,NULL))
1472-
== NULL) return NULL;
1474+
if ((sdsele = rdbGenericLoadStringObject(rdb,RDB_LOAD_SDS,NULL)) == NULL) {
1475+
decrRefCount(o);
1476+
return NULL;
1477+
}
14731478

14741479
if (o->encoding == OBJ_ENCODING_INTSET) {
14751480
/* Fetch integer value from element. */
@@ -1508,13 +1513,23 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key) {
15081513
double score;
15091514
zskiplistNode *znode;
15101515

1511-
if ((sdsele = rdbGenericLoadStringObject(rdb,RDB_LOAD_SDS,NULL))
1512-
== NULL) return NULL;
1516+
if ((sdsele = rdbGenericLoadStringObject(rdb,RDB_LOAD_SDS,NULL)) == NULL) {
1517+
decrRefCount(o);
1518+
return NULL;
1519+
}
15131520

15141521
if (rdbtype == RDB_TYPE_ZSET_2) {
1515-
if (rdbLoadBinaryDoubleValue(rdb,&score) == -1) return NULL;
1522+
if (rdbLoadBinaryDoubleValue(rdb,&score) == -1) {
1523+
decrRefCount(o);
1524+
sdsfree(sdsele);
1525+
return NULL;
1526+
}
15161527
} else {
1517-
if (rdbLoadDoubleValue(rdb,&score) == -1) return NULL;
1528+
if (rdbLoadDoubleValue(rdb,&score) == -1) {
1529+
decrRefCount(o);
1530+
sdsfree(sdsele);
1531+
return NULL;
1532+
}
15181533
}
15191534

15201535
/* Don't care about integer-encoded strings. */
@@ -1546,10 +1561,15 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key) {
15461561
while (o->encoding == OBJ_ENCODING_ZIPLIST && len > 0) {
15471562
len--;
15481563
/* Load raw strings */
1549-
if ((field = rdbGenericLoadStringObject(rdb,RDB_LOAD_SDS,NULL))
1550-
== NULL) return NULL;
1551-
if ((value = rdbGenericLoadStringObject(rdb,RDB_LOAD_SDS,NULL))
1552-
== NULL) return NULL;
1564+
if ((field = rdbGenericLoadStringObject(rdb,RDB_LOAD_SDS,NULL)) == NULL) {
1565+
decrRefCount(o);
1566+
return NULL;
1567+
}
1568+
if ((value = rdbGenericLoadStringObject(rdb,RDB_LOAD_SDS,NULL)) == NULL) {
1569+
sdsfree(field);
1570+
decrRefCount(o);
1571+
return NULL;
1572+
}
15531573

15541574
/* Add pair to ziplist */
15551575
o->ptr = ziplistPush(o->ptr, (unsigned char*)field,
@@ -1577,10 +1597,15 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key) {
15771597
while (o->encoding == OBJ_ENCODING_HT && len > 0) {
15781598
len--;
15791599
/* Load encoded strings */
1580-
if ((field = rdbGenericLoadStringObject(rdb,RDB_LOAD_SDS,NULL))
1581-
== NULL) return NULL;
1582-
if ((value = rdbGenericLoadStringObject(rdb,RDB_LOAD_SDS,NULL))
1583-
== NULL) return NULL;
1600+
if ((field = rdbGenericLoadStringObject(rdb,RDB_LOAD_SDS,NULL)) == NULL) {
1601+
decrRefCount(o);
1602+
return NULL;
1603+
}
1604+
if ((value = rdbGenericLoadStringObject(rdb,RDB_LOAD_SDS,NULL)) == NULL) {
1605+
sdsfree(field);
1606+
decrRefCount(o);
1607+
return NULL;
1608+
}
15841609

15851610
/* Add pair to hash table */
15861611
ret = dictAdd((dict*)o->ptr, field, value);
@@ -1600,7 +1625,10 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key) {
16001625
while (len--) {
16011626
unsigned char *zl =
16021627
rdbGenericLoadStringObject(rdb,RDB_LOAD_PLAIN,NULL);
1603-
if (zl == NULL) return NULL;
1628+
if (zl == NULL) {
1629+
decrRefCount(o);
1630+
return NULL;
1631+
}
16041632
quicklistAppendZiplist(o->ptr, zl);
16051633
}
16061634
} else if (rdbtype == RDB_TYPE_HASH_ZIPMAP ||

tests/integration/aof.tcl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ tags {"aof"} {
5454

5555
set client [redis [dict get $srv host] [dict get $srv port] 0 $::tls]
5656

57+
wait_for_condition 50 100 {
58+
[catch {$client ping} e] == 0
59+
} else {
60+
fail "Loading DB is taking too much time."
61+
}
62+
5763
test "Truncated AOF loaded: we expect foo to be equal to 5" {
5864
assert {[$client get foo] eq "5"}
5965
}
@@ -71,6 +77,12 @@ tags {"aof"} {
7177

7278
set client [redis [dict get $srv host] [dict get $srv port] 0 $::tls]
7379

80+
wait_for_condition 50 100 {
81+
[catch {$client ping} e] == 0
82+
} else {
83+
fail "Loading DB is taking too much time."
84+
}
85+
7486
test "Truncated AOF loaded: we expect foo to be equal to 6 now" {
7587
assert {[$client get foo] eq "6"}
7688
}

tests/integration/replication-3.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ start_server {tags {"repl"}} {
118118
# correctly the RDB file: such file will contain "lua" AUX
119119
# sections with scripts already in the memory of the master.
120120

121-
wait_for_condition 50 100 {
121+
wait_for_condition 500 100 {
122122
[s -1 master_link_status] eq {up}
123123
} else {
124124
fail "Replication not started."

0 commit comments

Comments
 (0)