From 70efeda479d82ebc0392d49e5f7986a306939882 Mon Sep 17 00:00:00 2001
From: josh <josh@elixxir.io>
Date: Thu, 10 Jun 2021 16:36:14 -0700
Subject: [PATCH] Fix segfault

---
 storage/partition/store.go | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/storage/partition/store.go b/storage/partition/store.go
index 0d7542a2f..f8a0e8e2c 100644
--- a/storage/partition/store.go
+++ b/storage/partition/store.go
@@ -130,8 +130,10 @@ func (s *Store) saveActiveParts() {
 	jww.INFO.Printf("Saving %d active partitions", len(s.activeParts))
 	activeList := make([]*multiPartMessage, 0, len(s.activeParts))
 	for mpm := range s.activeParts {
+		mpm.mux.Lock()
 		jww.INFO.Printf("saveActiveParts saving %v", mpm)
 		activeList = append(activeList, mpm)
+		mpm.mux.Unlock()
 	}
 
 	data, err := json.Marshal(&activeList)
@@ -167,8 +169,8 @@ func (s *Store) loadActivePartitions() {
 	}
 	jww.INFO.Printf("loadActivePartitions found %d active", len(activeList))
 
-	for i, mpm := range activeList {
-		jww.INFO.Printf("loaded %d partition: %v", i, mpm)
+	for _, activeMpm := range activeList {
+		mpm := loadOrCreateMultiPartMessage(activeMpm.Sender, activeMpm.MessageID, s.kv)
 		s.activeParts[mpm] = true
 	}
 
-- 
GitLab