Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic error: query results in "assignment to entry in nil map" #3041

Closed
danielmai opened this issue Feb 19, 2019 · 1 comment
Closed

panic error: query results in "assignment to entry in nil map" #3041

danielmai opened this issue Feb 19, 2019 · 1 comment
Assignees
Labels
kind/bug Something is broken.

Comments

@danielmai
Copy link
Contributor

  • What version of Dgraph are you using?
    v1.0.12-rc5, master (06df966)

  • Have you tried reproducing the issue with latest release?
    Yes. v1.0.11 works OK.

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

    • Run Dgraph cluster (clean).
    • Run query
    $ curl localhost:8080/query -d '
    {
      var(func: has(pred)) {
        n as uid
        cnt as count(_predicate_)
      }
    
      data(func: uid(n)) @filter(gt(val(cnt), 4)) {
        expand(_all_)
      }
    }'

    or this query

    $ curl localhost:8080/query -d '
    {
      var(func: uid(0x1)) {
        cnt as _predicate_
      }
    
      data(func: uid(0x1)) {
        val(cnt)
      }
    }'
  • Result:

2019/02/19 09:48:01 http: panic serving 127.0.0.1:40140: assignment to entry in nil map
goroutine 237 [running]:
net/http.(*conn).serve.func1(0xc0006448c0)
	/snap/go/3129/src/net/http/server.go:1746 +0xd0
panic(0x1379000, 0x15d5cf0)
	/snap/go/3129/src/runtime/panic.go:513 +0x1b9
github.com/dgraph-io/dgraph/query.(*SubGraph).fillVars(0xc00add6580, 0xc00049bbc0, 0xc00048a287, 0x3)
	/home/dmai/go/src/github.com/dgraph-io/dgraph/query/query.go:1705 +0x5a1
github.com/dgraph-io/dgraph/query.(*SubGraph).recursiveFillVars(0xc00add6580, 0xc00049bbc0, 0x0, 0x0)
	/home/dmai/go/src/github.com/dgraph-io/dgraph/query/query.go:1644 +0x39
github.com/dgraph-io/dgraph/query.(*SubGraph).recursiveFillVars(0xc00add62c0, 0xc00049bbc0, 0xc00adbc3c0, 0x1)
	/home/dmai/go/src/github.com/dgraph-io/dgraph/query/query.go:1649 +0xa6
github.com/dgraph-io/dgraph/query.(*QueryRequest).ProcessQuery(0xc00ad59b30, 0x15ebb20, 0xc00ad3b980, 0x1, 0x1)
	/home/dmai/go/src/github.com/dgraph-io/dgraph/query/query.go:2616 +0x61d
github.com/dgraph-io/dgraph/query.(*QueryRequest).Process(0xc00ad59b30, 0x15ebb20, 0xc00ad3b980, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/dmai/go/src/github.com/dgraph-io/dgraph/query/query.go:2710 +0x5e
github.com/dgraph-io/dgraph/edgraph.(*Server).doQuery(0xc000481c40, 0x15ebb20, 0xc00ade4240, 0xc00ad657c0, 0xc00ad13d40, 0x0, 0x0)
	/home/dmai/go/src/github.com/dgraph-io/dgraph/edgraph/server.go:579 +0x639
github.com/dgraph-io/dgraph/edgraph.(*Server).Query(0xc000481c40, 0x15ebb20, 0xc00ad3b890, 0xc00ad657c0, 0x2029de0, 0x2029de0, 0x15ebb20)
	/home/dmai/go/src/github.com/dgraph-io/dgraph/edgraph/server.go:508 +0x9b
github.com/dgraph-io/dgraph/dgraph/cmd/alpha.queryHandler(0x15eaa60, 0xc00ad321c0, 0xc000044600)
	/home/dmai/go/src/github.com/dgraph-io/dgraph/dgraph/cmd/alpha/http.go:169 +0x2f4
net/http.HandlerFunc.ServeHTTP(0x14fc748, 0x15eaa60, 0xc00ad321c0, 0xc000044600)
	/snap/go/3129/src/net/http/server.go:1964 +0x44
net/http.(*ServeMux).ServeHTTP(0x2009760, 0x15eaa60, 0xc00ad321c0, 0xc000044600)
	/snap/go/3129/src/net/http/server.go:2361 +0x127
net/http.serverHandler.ServeHTTP(0xc0000ec820, 0x15eaa60, 0xc00ad321c0, 0xc000044600)
	/snap/go/3129/src/net/http/server.go:2741 +0xab
net/http.(*conn).serve(0xc0006448c0, 0x15eba60, 0xc00067dfc0)
	/snap/go/3129/src/net/http/server.go:1847 +0x646
created by net/http.(*Server).Serve
	/snap/go/3129/src/net/http/server.go:2851 +0x2f5

On v1.0.11, the query response for the first query is empty:

{
  "data": {
    "data": []
  }
}

And for the latter query (v1.0.11):

{
  "errors": [
    {
      "code": "ErrorInvalidRequest",
      "message": "Wrong use of var() with [{cnt 2}]."
    }
  ],
  "data": null
}
@danielmai danielmai added the kind/bug Something is broken. label Feb 19, 2019
@srfrog srfrog self-assigned this Feb 19, 2019
@srfrog
Copy link
Contributor

srfrog commented Feb 19, 2019

Seems to be due to a missing field map init. I've linked the PR fix.
And both queries should return empty since 1.0.12

{
  "data": {
    "data": []
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something is broken.
Development

No branches or pull requests

2 participants