Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
c73b4ddf
Unverified
Commit
c73b4ddf
authored
Apr 19, 2021
by
Madelyn Olson
Committed by
GitHub
Apr 19, 2021
Browse files
Fix memory leak when doing lazyfreeing client tracking table (#8822)
Interior rax pointers were not being freed
parent
c2aff4c7
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/lazyfree.c
View file @
c73b4ddf
...
@@ -39,12 +39,11 @@ void lazyfreeFreeSlotsMap(void *args[]) {
...
@@ -39,12 +39,11 @@ void lazyfreeFreeSlotsMap(void *args[]) {
atomicIncr
(
lazyfreed_objects
,
len
);
atomicIncr
(
lazyfreed_objects
,
len
);
}
}
/* Release the rax mapping Redis Cluster keys to slots in the
/* Release the key tracking table. */
* lazyfree thread. */
void
lazyFreeTrackingTable
(
void
*
args
[])
{
void
lazyFreeTrackingTable
(
void
*
args
[])
{
rax
*
rt
=
args
[
0
];
rax
*
rt
=
args
[
0
];
size_t
len
=
rt
->
numele
;
size_t
len
=
rt
->
numele
;
raxF
ree
(
rt
);
freeTrackingRadixT
ree
(
rt
);
atomicDecr
(
lazyfree_objects
,
len
);
atomicDecr
(
lazyfree_objects
,
len
);
atomicIncr
(
lazyfreed_objects
,
len
);
atomicIncr
(
lazyfreed_objects
,
len
);
}
}
...
...
src/server.h
View file @
c73b4ddf
...
@@ -1911,6 +1911,7 @@ void disableTracking(client *c);
...
@@ -1911,6 +1911,7 @@ void disableTracking(client *c);
void
trackingRememberKeys
(
client
*
c
);
void
trackingRememberKeys
(
client
*
c
);
void
trackingInvalidateKey
(
client
*
c
,
robj
*
keyobj
);
void
trackingInvalidateKey
(
client
*
c
,
robj
*
keyobj
);
void
trackingInvalidateKeysOnFlush
(
int
async
);
void
trackingInvalidateKeysOnFlush
(
int
async
);
void
freeTrackingRadixTree
(
rax
*
rt
);
void
freeTrackingRadixTreeAsync
(
rax
*
rt
);
void
freeTrackingRadixTreeAsync
(
rax
*
rt
);
void
trackingLimitUsedSlots
(
void
);
void
trackingLimitUsedSlots
(
void
);
uint64_t
trackingGetTotalItems
(
void
);
uint64_t
trackingGetTotalItems
(
void
);
...
...
tests/unit/tracking.tcl
View file @
c73b4ddf
...
@@ -395,6 +395,17 @@ start_server {tags {"tracking network"}} {
...
@@ -395,6 +395,17 @@ start_server {tags {"tracking network"}} {
assert
{[
lindex msg 2
]
eq
{}
}
assert
{[
lindex msg 2
]
eq
{}
}
}
}
test
{
Test ASYNC flushall
}
{
clean_all
r CLIENT TRACKING on REDIRECT $redir_id
r GET key1
r GET key2
assert_equal
[
s 0 tracking_total_keys
]
2
$rd_sg FLUSHALL ASYNC
assert_equal
[
s 0 tracking_total_keys
]
0
assert_equal
[
lindex
[
$rd
_redirection read
]
2
]
{}
}
# Keys are defined to be evicted 100 at a time by default.
# Keys are defined to be evicted 100 at a time by default.
# If after eviction the number of keys still surpasses the limit
# If after eviction the number of keys still surpasses the limit
# defined in tracking-table-max-keys, we increases eviction
# defined in tracking-table-max-keys, we increases eviction
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment