From bf844d8e4623932cbe48d1b461894ade8a65b610 Mon Sep 17 00:00:00 2001 From: gfx <86091021+gfxlabs@users.noreply.github.com> Date: Sun, 4 Sep 2022 22:32:10 -0500 Subject: [PATCH] Fix crash in arangodb filer when attempting to access a deleted bucket (#3587) * Update helpers.go * Update arangodb_store_bucket.go --- weed/filer/arangodb/arangodb_store_bucket.go | 3 +++ weed/filer/arangodb/helpers.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/weed/filer/arangodb/arangodb_store_bucket.go b/weed/filer/arangodb/arangodb_store_bucket.go index b35a5c9b3..44aeeadea 100644 --- a/weed/filer/arangodb/arangodb_store_bucket.go +++ b/weed/filer/arangodb/arangodb_store_bucket.go @@ -34,6 +34,9 @@ func (store *ArangodbStore) OnBucketDeletion(bucket string) { glog.Errorf("bucket delete %s: %v", bucket, err) return } + store.mu.Lock() + delete(store.buckets, bucket) + store.mu.Unlock() } func (store *ArangodbStore) CanDropWholeBucket() bool { return true diff --git a/weed/filer/arangodb/helpers.go b/weed/filer/arangodb/helpers.go index 35796a8f8..3f36acb0a 100644 --- a/weed/filer/arangodb/helpers.go +++ b/weed/filer/arangodb/helpers.go @@ -86,7 +86,7 @@ func (store *ArangodbStore) ensureBucket(ctx context.Context, bucket string) (bc store.mu.RLock() bc, ok = store.buckets[bucket] store.mu.RUnlock() - if ok { + if ok && bc != nil { return bc, nil } store.mu.Lock()