Skip to content

Querying for non-existent record by constrained field panics #74

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

Open
matthewmcneely opened this issue Feb 20, 2025 · 2 comments · May be fixed by #75
Open

Querying for non-existent record by constrained field panics #74

matthewmcneely opened this issue Feb 20, 2025 · 2 comments · May be fixed by #75
Assignees
Labels
bug Something isn't working

Comments

@matthewmcneely
Copy link
Member

Describe the bug
Querying for non-existent record panics in worker

To Reproduce

type Config struct {
	Gid  uint64 `json:"gid,omitempty"`
	Name string `json:"name,omitempty"`
}

func main() {
	engine, err := modusdb.NewEngine(modusdb.NewDefaultConfig("./db"))
	if err != nil {
		log.Fatalf("Failed to create engine: %v", err)
	}
	defer engine.Close()

	ctx := context.Background()

	gid, config, err := modusdb.Get[Config](ctx, engine,
		modusdb.ConstrainedField{
			Key:   "name",
			Value: "main",
		},
	)
panic: runtime error: integer divide by zero

goroutine 97 [running]:
github.com/hypermodeinc/dgraph/v24/worker.(*groupi).connToZeroLeader(0x1064dc1e0)
        /Users/matthew/go/pkg/mod/github.com/hypermodeinc/dgraph/[email protected]/worker/groups.go:738 +0x374
github.com/hypermodeinc/dgraph/v24/worker.(*groupi).BelongsToReadOnly(0x1064dc1e0, {0x1400053c120, 0xd}, 0x2)
        /Users/matthew/go/pkg/mod/github.com/hypermodeinc/dgraph/[email protected]/worker/groups.go:440 +0x164
github.com/hypermodeinc/dgraph/v24/worker.ProcessTaskOverNetwork({0x1058a1718, 0x1400031e330}, 0x14000494000)
        /Users/matthew/go/pkg/mod/github.com/hypermodeinc/dgraph/[email protected]/worker/task.go:137 +0x54
github.com/hypermodeinc/dgraph/v24/query.ProcessGraph({0x1058a1718, 0x1400031e330}, 0x1400051a908, 0x0, 0x1400069caf0)
        /Users/matthew/go/pkg/mod/github.com/hypermodeinc/dgraph/[email protected]/query/query.go:2170 +0x870
created by github.com/hypermodeinc/dgraph/v24/query.(*Request).ProcessQuery in goroutine 1
        /Users/matthew/go/pkg/mod/github.com/hypermodeinc/dgraph/[email protected]/query/query.go:2884 +0xaa8

Expected behavior
Should be able to query for a non-existent type and have it return a not-found error

Additional Context
I believe this is because there's no schema applied before this query. And the worker is trying to find the group the predicates belong to.

Environment

  • OS: macOS
  • Language Go
@matthewmcneely matthewmcneely added the bug Something isn't working label Feb 20, 2025
@matthewmcneely matthewmcneely self-assigned this Feb 20, 2025
Copy link

linear bot commented Feb 20, 2025

@matthewmcneely
Copy link
Member Author

Update, this is only happening with the modusdb.ConstrainedField option. The standard gid search returns "object not found" correctly.

@matthewmcneely matthewmcneely changed the title Querying for non-existent record in db panics Querying for non-existent record by constrained field panics Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

1 participant