dgraph icon indicating copy to clipboard operation
dgraph copied to clipboard

panic: runtime error: slice bounds out of range

Open aditya-pr opened this issue 8 years ago • 7 comments

  • What version of Dgraph are you using? v1.0.6

  • Have you tried reproducing the issue with latest release? using latest

  • What is the hardware spec (RAM, OS)?

         requests:
            memory: "5120Mi"
            cpu: "1000m"
          limits:
            memory: "6144Mi"
            cpu: "1250m"

OS: ubuntu:16.04 (docker base image)

  • Steps to reproduce the issue (command/config used to run Dgraph). Same as here.

  • Expected behaviour and actual result. Dgraph server crashes with slice bounds out of range on two locations:

panic: runtime error: slice bounds out of range

goroutine 181 [running]:
github.com/dgraph-io/dgraph/bp128.(*BPackIterator).Init(0xc4202a9c18, 0xc46e0da840, 0x22, 0x22, 0x0)
	/home/aditya/go/src/github.com/dgraph-io/dgraph/bp128/bp128.go:226 +0x457
github.com/dgraph-io/dgraph/posting.(*PIterator).Init(0xc4202a9bf0, 0xc433c4c6e0, 0x0)
	/home/aditya/go/src/github.com/dgraph-io/dgraph/posting/list.go:101 +0xaa
github.com/dgraph-io/dgraph/posting.(*List).iterate(0xc469992d80, 0x18ff3e, 0x0, 0xc4202a9d38, 0x0, 0x100)
	/home/aditya/go/src/github.com/dgraph-io/dgraph/posting/list.go:554 +0xf7
github.com/dgraph-io/dgraph/posting.(*List).rollup(0xc469992d80, 0xc4704c1c80, 0xc4204b5500)
	/home/aditya/go/src/github.com/dgraph-io/dgraph/posting/list.go:687 +0x145
github.com/dgraph-io/dgraph/posting.(*List).syncIfDirty(0xc469992d80, 0x1419501, 0xc469992d80, 0x1419548, 0xc469992d80)
	/home/aditya/go/src/github.com/dgraph-io/dgraph/posting/list.go:748 +0xa0
github.com/dgraph-io/dgraph/posting.(*List).SyncIfDirty(0xc469992d80, 0xc42007b901, 0xc4421e2f00, 0x0, 0x0)
	/home/aditya/go/src/github.com/dgraph-io/dgraph/posting/list.go:641 +0x85
github.com/dgraph-io/dgraph/posting.(*listCache).removeOldest(0xc42039c230)
	/home/aditya/go/src/github.com/dgraph-io/dgraph/posting/lru.go:141 +0x109
github.com/dgraph-io/dgraph/posting.(*listCache).removeOldestLoop(0xc42039c230)
	/home/aditya/go/src/github.com/dgraph-io/dgraph/posting/lru.go:115 +0xd1

and

panic: runtime error: slice bounds out of range

goroutine 1964993 [running]:
github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/skl.(*Arena).getVal(0xc44c8236e0, 0xf62a0ba68, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/aditya/go/src/github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/skl/arena.go:124 +0xab
github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/skl.(*Skiplist).Get(0xc44c823700, 0xc466853260, 0x21, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/aditya/go/src/github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/skl/skl.go:387 +0x16f
github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger.(*DB).get(0xc420092380, 0xc466853260, 0x21, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/aditya/go/src/github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/db.go:501 +0x128
github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger.(*Item).yieldItemValue(0xc43c322580, 0x1ba6350, 0xc43087f768, 0x92a264, 0xc42f636bd4, 0x0, 0xc43087f790)
	/home/aditya/go/src/github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/iterator.go:178 +0x49e
github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger.(*Item).prefetchValue(0xc43c322580)
	/home/aditya/go/src/github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/iterator.go:198 +0x35
github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger.(*Iterator).fill.func1(0xc43c322580)
	/home/aditya/go/src/github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/iterator.go:524 +0x2b

aditya-pr avatar Jul 03 '18 13:07 aditya-pr

Are these related? Did they both happen at the same time?

manishrjain avatar Jul 03 '18 23:07 manishrjain

Are these related?

nope

Did they both happen at the same time?

no. these probably should have been filed separately. bager (second trace) one is more frequent than .*BPackIterator.Init.

aditya-pr avatar Jul 04 '18 04:07 aditya-pr

I was able to reproduce the bug in Badger via this thread: https://discuss.dgraph.io/t/upgrade-from-1-0-4-to-1-0-6-crash-and-data-loss/2868/11

The fix is now part of Badger and has been imported into Dgraph master. https://github.com/dgraph-io/badger/commit/a7cf7d9f9bc85af2c03ff8c63b2a824691978e2e

I plan to cut v1.0.7 release soon (by next week). If you need this fix in v1.0.6 urgently, let me know. Closing the issue.

manishrjain avatar Jul 11 '18 22:07 manishrjain

@manishrjain any word on when this fix gonna drop (v1.0.7?)

billylindeman avatar Aug 02 '18 23:08 billylindeman

Will make the official v1.0.7 release this week. I did cut 4 release candidates for v1.0.7, the latest is v1.0.7-rc4.

manishrjain avatar Aug 08 '18 02:08 manishrjain

Hi. We're experiencing this bug in 1.0.8 and 1.0.9.

1.0.8 crashed once, then we upgraded dgraph to 1.0.9 but it crashed again.

Oct 19 10:38:10 our-server dgraph[151922]: 2018/10/19 10:38:10 WARNING: This entry should have been caught. {Key:[<truncated>] Value:[<truncated>
Oct 19 10:38:10 our-server dgraph[151922]: 2018/10/19 10:38:10 WARNING: This entry should have been caught. {Key:[<truncated>] Value:[<truncated>
Oct 19 14:39:27 our-server dgraph[151922]: panic: runtime error: slice bounds out of range
Oct 19 14:39:27 our-server dgraph[151922]: goroutine 12261783 [running]:
Oct 19 14:39:27 our-server dgraph[151922]: github.com/dgraph-io/dgraph/bp128.(*BPackIterator).Init(0xc091265628, 0xc04ea0c180, 0x55, 0x55, 0x0)
Oct 19 14:39:27 our-server dgraph[151922]: /ext-go/1/src/github.com/dgraph-io/dgraph/bp128/bp128.go:226 +0x3c0
Oct 19 14:39:27 our-server dgraph[151922]: github.com/dgraph-io/dgraph/posting.(*PIterator).Init(0xc091265600, 0xc07fdb41e0, 0x0)
Oct 19 14:39:27 our-server dgraph[151922]: /ext-go/1/src/github.com/dgraph-io/dgraph/posting/list.go:101 +0xa4
Oct 19 14:39:27 our-server dgraph[151922]: github.com/dgraph-io/dgraph/posting.(*List).iterate(0xc07185b680, 0x14c08c, 0x0, 0xc0912658d8, 0x9, 0xc008a9ef80)
Oct 19 14:39:27 our-server dgraph[151922]: /ext-go/1/src/github.com/dgraph-io/dgraph/posting/list.go:558 +0xf3
Oct 19 14:39:27 our-server dgraph[151922]: github.com/dgraph-io/dgraph/posting.(*List).Iterate(0xc07185b680, 0x14c08c, 0x0, 0xc0912658d8, 0x0, 0x0)
Oct 19 14:39:27 our-server dgraph[151922]: /ext-go/1/src/github.com/dgraph-io/dgraph/posting/list.go:459 +0x8b
Oct 19 14:39:27 our-server dgraph[151922]: github.com/dgraph-io/dgraph/worker.handleHasFunction(0x147da00, 0xc09c5359e0, 0xc00023e2a0, 0xc0458f0a20, 0x0, 0x0)
Oct 19 14:39:28 our-server dgraph[151922]: /ext-go/1/src/github.com/dgraph-io/dgraph/worker/task.go:1695 +0x9cf
Oct 19 14:39:28 our-server dgraph[151922]: github.com/dgraph-io/dgraph/worker.helpProcessTask(0x147da00, 0xc09c5359e0, 0xc00023e2a0, 0x1, 0x0, 0x0, 0x105465f)
Oct 19 14:39:28 our-server dgraph[151922]: /ext-go/1/src/github.com/dgraph-io/dgraph/worker/task.go:678 +0x5ae
Oct 19 14:39:28 our-server dgraph[151922]: github.com/dgraph-io/dgraph/worker.processTask(0x147da00, 0xc09c5359e0, 0xc00023e2a0, 0x1, 0x836400, 0xc00023e2a0, 0xc013f63bd0)
Oct 19 14:39:28 our-server dgraph[151922]: /ext-go/1/src/github.com/dgraph-io/dgraph/worker/task.go:613 +0xf4
Oct 19 14:39:28 our-server systemd[1]: dgraph-server.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Oct 19 14:39:28 our-server systemd[1]: Unit dgraph-server.service entered failed state.
Oct 19 14:39:28 our-server systemd[1]: dgraph-server.service failed.
Oct 19 15:06:55 our-server dgraph[65430]: Dgraph version   : v1.0.9
Oct 19 15:06:55 our-server dgraph[65430]: Commit SHA-1     : 22c13fce
Oct 19 15:06:55 our-server dgraph[65430]: Commit timestamp : 2018-10-02 16:45:53 -0700
Oct 19 15:06:55 our-server dgraph[65430]: Branch           : HEAD

Could you check this again? Thank you!

hoonmin avatar Oct 19 '18 10:10 hoonmin

Did you export and reimport when you upgraded to 1.0.8?

manishrjain avatar Oct 19 '18 13:10 manishrjain