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

fillGroupedVars: runtime error: invalid memory address or nil pointer dereference #3768

Closed
d4l3k opened this issue Aug 7, 2019 · 0 comments · Fixed by #3781
Closed

fillGroupedVars: runtime error: invalid memory address or nil pointer dereference #3768

d4l3k opened this issue Aug 7, 2019 · 0 comments · Fixed by #3781
Assignees
Labels
area/querylang/groupby Issues related to the @groupby directive. kind/bug Something is broken. priority/P0 Critical issue that requires immediate attention. status/accepted We accept to investigate/work on it.
Milestone

Comments

@d4l3k
Copy link

d4l3k commented Aug 7, 2019

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

  • What version of Dgraph are you using?
    Dgraph version : v1.0.16
    Commit SHA-1 : 0590ee9
    Commit timestamp : 2019-07-11 11:52:54 -0700
    Branch : HEAD
    Go version : go1.12.5

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

  • What is the hardware spec (RAM, OS)?
    32GB RAM, Arch Linux, running in docker compose

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

		resp, err := s.dgo.NewReadOnlyTxn().BestEffort().QueryWithVars(ctx,
			`query recs($url: string) {
				docs(func: eq(url, $url)) {
					url
					title
					desc
				}

				var(func: eq(url, $url)) @ignorereflex {
					~likes {
						likes {
							uids as uid
						}
					}
				}

				var(func: uid(uids)) @groupby(uid) {
					counts as count(uid)
				}

				recs(func: uid(counts)) {
					count: val(counts)
					url
					title
					desc
				}
			}
		`,
			map[string]string{"$url": url},
		)

schema

<author>: uid @reverse .
<chapters>: int .
<complete>: bool .
<created>: string .
<desc>: string .
<image>: string .
<likecount>: int .
<likes>: uid @count @reverse .
<name>: string .
<reviews>: int .
<tags>: [string] .
<title>: string .
<updated>: string .
<url>: string @index(hash) @upsert .
<urls>: [string] .
<username>: string @index(hash) @upsert .
<wordcount>: int .
  • Expected behaviour and actual result.

It returns the results.

Instead it crashes the server with error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x11e0793]

goroutine 577 [running]:
github.com/dgraph-io/dgraph/query.(*SubGraph).fillGroupedVars(0xc0482d1600, 0xc0482ce120, 0xc01a658000, 0x0, 0x1, 0xc01a658008, 0x0)
        /tmp/go/src/github.com/dgraph-io/dgraph/query/groupby.go:298 +0x223
github.com/dgraph-io/dgraph/query.(*SubGraph).processGroupBy(0xc0482d1600, 0xc0482ce120, 0xc01a658000, 0x0, 0x1, 0x1f86470, 0xc002abf6b8)
        /tmp/go/src/github.com/dgraph-io/dgraph/query/groupby.go:383 +0x1a7
github.com/dgraph-io/dgraph/query.(*SubGraph).valueVarAggregation(0xc0482d1600, 0xc0482ce120, 0xc01a658000, 0x0, 0x1, 0x0, 0x0, 0x0)
        /tmp/go/src/github.com/dgraph-io/dgraph/query/query.go:1196 +0xdb2
github.com/dgraph-io/dgraph/query.(*SubGraph).populatePostAggregation(0xc0482d1600, 0xc0482ce120, 0xc01a658000, 0x1, 0x1, 0x0, 0x0, 0x1)
        /tmp/go/src/github.com/dgraph-io/dgraph/query/query.go:1295 +0x19d
github.com/dgraph-io/dgraph/query.(*QueryRequest).ProcessQuery(0xc002abfb30, 0x16f1340, 0xc00049ba40, 0x1, 0x1)
        /tmp/go/src/github.com/dgraph-io/dgraph/query/query.go:2582 +0xd2b
github.com/dgraph-io/dgraph/query.(*QueryRequest).Process(0xc002abfb30, 0x16f1340, 0xc00049ba40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /tmp/go/src/github.com/dgraph-io/dgraph/query/query.go:2628 +0x5e
github.com/dgraph-io/dgraph/edgraph.(*Server).Query(0x1f86470, 0x16f1340, 0xc00049ba40, 0xc051a71bd0, 0xc001d01aa0, 0x0, 0x0)
        /tmp/go/src/github.com/dgraph-io/dgraph/edgraph/server.go:516 +0x61b
github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/dgo/protos/api._Dgraph_Query_Handler(0x14838c0, 0x1f86470, 0x16f1340, 0xc00049b8c0, 0xc0003c18f0, 0x0, 0x16f1340, 0xc00049b8c0, 0xc0002d2a00, 0xc064d1cc78)
        /tmp/go/src/github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/dgo/protos/api/api.pb.go:1757 +0x23e
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000402000, 0x16fdd40, 0xc0482aa000, 0xc0002d2a00, 0xc051ac01e0, 0x1ebd778, 0x0, 0x0, 0x0)
        /tmp/go/src/google.golang.org/grpc/server.go:1011 +0x4c3
google.golang.org/grpc.(*Server).handleStream(0xc000402000, 0x16fdd40, 0xc0482aa000, 0xc0002d2a00, 0x0)
        /tmp/go/src/google.golang.org/grpc/server.go:1249 +0x12b5
google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc0482592b0, 0xc000402000, 0x16fdd40, 0xc0482aa000, 0xc0002d2a00)
        /tmp/go/src/google.golang.org/grpc/server.go:680 +0x9f
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /tmp/go/src/google.golang.org/grpc/server.go:678 +0xa1
@d4l3k d4l3k changed the title dgraph segmentation fault on query in fillGroupedVars fillGroupedVars: runtime error: invalid memory address or nil pointer dereference Aug 7, 2019
@mangalaman93 mangalaman93 added area/querylang/groupby Issues related to the @groupby directive. kind/bug Something is broken. priority/P0 Critical issue that requires immediate attention. status/accepted We accept to investigate/work on it. labels Aug 7, 2019
@pawanrawal pawanrawal self-assigned this Aug 7, 2019
pawanrawal added a commit that referenced this issue Aug 9, 2019
Use DestUIDs() function while accessing uids from child in GroupBy query. This fixes #3768.
pawanrawal added a commit that referenced this issue Aug 9, 2019
Use DestUIDs() function while accessing uids from child in GroupBy query. This fixes #3768.
pawanrawal added a commit that referenced this issue Aug 9, 2019
Use DestUIDs() function while accessing uids from child in GroupBy query. This fixes #3768.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/querylang/groupby Issues related to the @groupby directive. kind/bug Something is broken. priority/P0 Critical issue that requires immediate attention. status/accepted We accept to investigate/work on it.
Development

Successfully merging a pull request may close this issue.

3 participants