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?
    v1.0.0

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

  • 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"))
{
uid
expand(_all_)
}
}

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

func TestExpandEmptyResult(t *testing.T) {
	populateGraph(t)
	query := `
		{
			me(func: uid(0x01)) @filter(eq(name,"foobar")){
				expand(_all_)
			}
		}
	`
	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 https://github.com/dgraph-io/dgraph/commit/845dc6a71d72826f1d0781f0e531df52c525c1bd.

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.