Fix race in memory tracker (#254)
* fixes a data race in memory tracker that can cause divide-by-zero exceptions * Add comment to clarify that there is a potential race condition Co-authored-by: David Justo <david.justo.1996@gmail.com> --------- Co-authored-by: David Justo <david.justo.1996@gmail.com>
This commit is contained in:
Родитель
67255a9072
Коммит
08f823c711
|
@ -41,7 +41,9 @@ namespace DurableTask.Netherite.Faster
|
|||
|
||||
public void UpdateTargetSizes()
|
||||
{
|
||||
if (this.stores.Count > 0)
|
||||
// store count to avoid race condition where count goes to zero and causes divide-by-zero error
|
||||
int numberOfStores = this.stores.Count;
|
||||
if (numberOfStores > 0)
|
||||
{
|
||||
long targetSize = this.maxCacheSize / this.stores.Count;
|
||||
foreach (var s in this.stores.Keys)
|
||||
|
|
Загрузка…
Ссылка в новой задаче