Dgraph server panics when it tries to expand an empty result

If you suspect this could be a bug, follow the template.

  • What version of Dgraph are you using?

  • Have you tried reproducing the issue with latest release?

  • What is the hardware spec (RAM, OS)?
    RAM 16GB
    CPU 8 cores i7
    OS Ubuntu 16.04

  • Steps to reproduce the issue (command/config used to run Dgraph).
    setup a single dgraph instance as https://docs.dgraph.io/deploy/
    then query:

{yield(func: eq(valid_edge,"something exist"))  @filter(eq(valid_edge,"something does not exist"))

i.e. simple unit test in dgraph/query/query_test.go:

func TestExpandEmptyResult(t *testing.T) {
	query := `
			me(func: uid(0x01)) @filter(eq(name,"foobar")){
	js := processToFastJsonNoErr(t, query)
  • Expected behaviour and actual result.
    Expected: no result returned from the query.
    Actual result: UI get disconnected from dgraph server: Failed to fetch: Could not connect to the server

dgraph server log:

panic: runtime error: index out of range

goroutine 1479 [running]:
github.com/dgraph-io/dgraph/query.expandSubgraph(0x1a1e280, 0xc42ac95470, 0xc4200d0580, 0x0, 0x0, 0x0, 0x0, 0x2)
	/home/travis/gopath/src/github.com/dgraph-io/dgraph/query/query.go:1761 +0xef8
github.com/dgraph-io/dgraph/query.ProcessGraph(0x1a1e280, 0xc42ac95470, 0xc4200d0580, 0x0, 0xc42b12e5a0)
	/home/travis/gopath/src/github.com/dgraph-io/dgraph/query/query.go:2048 +0xced
created by github.com/dgraph-io/dgraph/query.(*QueryRequest).ProcessQuery
	/home/travis/gopath/src/github.com/dgraph-io/dgraph/query/query.go:2511 +0x964

Thanks for filing the issue @jzhu077. We will get it fixed and do another release today or tomorrow.

1 Like

A fix was merged to master with Fix panic in expand(_all_) on empty database. · dgraph-io/[email protected] · GitHub.

It should be available as part of the nightly build soon. We will also be making a patch release today or tomorrow.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.