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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

entgql nil time field order value cause msgpack panic #1559

Closed
2 tasks done
wenerme opened this issue May 13, 2021 · 9 comments
Closed
2 tasks done

entgql nil time field order value cause msgpack panic #1559

wenerme opened this issue May 13, 2021 · 9 comments

Comments

@wenerme
Copy link
Contributor

wenerme commented May 13, 2021

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 馃槸

image

image

v is (*time.Time)(nil), v.IsZero will panic

Expected Behavior 馃

order works

Steps to Reproduce 馃暪

https://github.com/wenerme/ent-demo/blob/fd782eec12be71f29279762951efe942378c2bd1/ent/gql_test.go#L8-L10

Your Environment 馃寧

Tech Version
Go 1.16
Ent latest
Database -
Driver -
@wenerme
Copy link
Contributor Author

wenerme commented May 13, 2021

relate issues vmihailenco/msgpack#306

@wenerme wenerme changed the title entgql ptr Time panic entgql nil field order value cause msgpack panic May 13, 2021
@alexsn
Copy link
Collaborator

alexsn commented May 25, 2021

Could you add your gql schema / query that's triggering this?

@wenerme wenerme changed the title entgql nil field order value cause msgpack panic entgql nil time field order value cause msgpack panic May 26, 2021
@wenerme
Copy link
Contributor Author

wenerme commented May 26, 2021

@alexsn order by a time field with nil value will trigger this, because *time.Time has IsZero, but the value is nil, msgpack will call the IsZero check cause panic

@alexsn
Copy link
Collaborator

alexsn commented May 26, 2021

Can you paste the graphql query that does this?

@wenerme
Copy link
Contributor Author

wenerme commented May 26, 2021

query {
  data: accounts(orderBy: {field: NextContactAt,direction: ASC}) {
    edges {
      node {
        id
      }
      cursor
    }
    totalCount
  }
}

NextContactAt is a *time.Time field

@wenerme
Copy link
Contributor Author

wenerme commented May 26, 2021

@alexsn
Copy link
Collaborator

alexsn commented May 26, 2021

Is NextContactAt a nillable field?

@wenerme
Copy link
Contributor Author

wenerme commented May 26, 2021

@alexsn Yes

@wenerme
Copy link
Contributor Author

wenerme commented May 28, 2021

This is fixed in latest msgpack

@wenerme wenerme closed this as completed May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants