From c4b6b0e3dda8db0e5a236f5118df8ec67e2afbd3 Mon Sep 17 00:00:00 2001 From: Ibrahim Jarif Date: Thu, 9 Jul 2020 17:37:45 +0530 Subject: [PATCH] fix(readPostingList): Return error instead of panic (#5877) 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 --- posting/mvcc.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/posting/mvcc.go b/posting/mvcc.go index 03275105496..c15b8744618 100644 --- a/posting/mvcc.go +++ b/posting/mvcc.go @@ -317,7 +317,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