From 4e31555537a4664b3d3aea482b11643c94feb1d5 Mon Sep 17 00:00:00 2001 From: Ibrahim Jarif Date: Tue, 14 Jul 2020 01:06:15 +0530 Subject: [PATCH] fix(readPostingList): Return error instead of panic (#5877) (#5908) We've seen some panics like "proto: illegal wireType 6" on trying to read the posting lists. We haven't found the fix yet. The issue could be because badger is returning incorrect values for the posting list. Since we haven't been able to reproduce it, this is a stop-gap solution to return an error instead of crashing dgraph. This is not the fix, this will return an error instead of causing a panic. Fixes DGRAPH-1778 (cherry picked from commit f2773c8eb362881928f3448c8ff109ef51c032ff) Co-authored-by: parasssh --- posting/mvcc.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/posting/mvcc.go b/posting/mvcc.go index 4815a54c051..50f63dbaa42 100644 --- a/posting/mvcc.go +++ b/posting/mvcc.go @@ -190,7 +190,9 @@ func ReadPostingList(key []byte, it *badger.Iterator) (*List, error) { case BitDeltaPosting: err := item.Value(func(val []byte) error { pl := &pb.PostingList{} - x.Check(pl.Unmarshal(val)) + if err := pl.Unmarshal(val); err != nil { + return err + } pl.CommitTs = item.Version() for _, mpost := range pl.Postings { // commitTs, startTs are meant to be only in memory, not