-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
broker: avoid double adding cache entry onto list
Problem: A dirty cache entry has to potential to be added onto the flush list twice. This double addition can lead to list corruption. The observed side effect was a list that was shortened and no longer accurate with respects to the `acct_dirty` counter. This could lead to hangs with content flush, missed flushes to the backing store, and segfault/memory corruption in the worst case. Solution: Remove the cache entry from the flush list before adding it. The remove is a no-op if it is not already on a list. Add regression test. Fixes #4482
- Loading branch information
Showing
5 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/sh -e | ||
|
||
# How this test works | ||
# | ||
# use rc1 script that does not load content-sqlite | ||
# | ||
# add some unique data to the kvs, we do multiple puts to build up | ||
# a decent length internal list of flushable cache entries. | ||
# | ||
# drop kvs cache, this will force future KVS puts of identical data to | ||
# be sent to the content-cache | ||
# | ||
# write the same data again, if error present internal flush list will | ||
# be messed up and length of flush list < number of dirty entries | ||
# (acct_dirty). | ||
# | ||
# before fix, flux content flush will hang b/c number of dirty entries | ||
# (acct_dirty) never reaches zero. | ||
|
||
cat <<-EOF >t4482.sh | ||
#!/bin/sh -e | ||
flux kvs put issue4482A.a="abcdefghijk" | ||
flux kvs put issue4482A.b="lmnopqrstuv" | ||
flux kvs put issue4482A.c="wxyz0123456" | ||
flux kvs put issue4482A.d="7890ABCDEFG" | ||
flux kvs put issue4482A.e="HIJKLMNOPQR" | ||
flux kvs put issue4482A.f="STUVWXYZ!!!" | ||
flux kvs put issue4482A.g="<<<<<:>>>>>" | ||
flux kvs dropcache | ||
flux kvs put issue4482B.a="abcdefghijk" | ||
flux kvs put issue4482B.b="lmnopqrstuv" | ||
flux kvs put issue4482B.c="wxyz0123456" | ||
flux kvs put issue4482B.d="7890ABCDEFG" | ||
flux kvs put issue4482B.e="HIJKLMNOPQR" | ||
flux kvs put issue4482B.f="STUVWXYZ!!!" | ||
flux kvs put issue4482B.g="<<<<<:>>>>>" | ||
flux module load content-sqlite | ||
flux content flush | ||
EOF | ||
|
||
chmod +x t4482.sh | ||
|
||
flux start -s 1 \ | ||
-o,--setattr=broker.rc1_path=${FLUX_SOURCE_DIR}/t/rc/rc1-issue4482 \ | ||
-o,--setattr=broker.rc3_path=${FLUX_SOURCE_DIR}/t/rc/rc3-issue4482 \ | ||
./t4482.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash -e | ||
|
||
# For issue4482 - assumes test size of 1 | ||
flux module load kvs | ||
flux module load kvs-watch | ||
flux module load heartbeat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash -e | ||
|
||
# For issue4482 - assumes test size of 1 | ||
flux module remove -f heartbeat | ||
flux module remove -f kvs-watch | ||
flux module remove -f kvs | ||
# content-sqlite loaded in test | ||
flux module remove -f content-sqlite |