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

fatal error: sweep increased allocation count #114

Closed
tonyghita opened this issue Sep 26, 2017 · 4 comments
Closed

fatal error: sweep increased allocation count #114

tonyghita opened this issue Sep 26, 2017 · 4 comments

Comments

@tonyghita
Copy link
Member

Hi, running this library on go 1.8.3 and seeing occasional crashes with fatal error: sweep increased allocation count.

I think this may be related to the usage of reflect.Call() but so far have not been able to reproduce locally. (Relevant issue: golang/go#21717).

Has anyone else observed this error?

@tonyghita
Copy link
Member Author

tonyghita commented Sep 28, 2017

I found the issue.

type Alphabet {
 a: String!
 b: String!
 c: String!
}

type Query {
  alphabet: Alphabet!
}
type AlphabetResolver struct {}
func (r AlphabetResolver) A() string {
  return "a"
}
func (r AlphabetResolver) B() string {
  return "b"
}
func (r AlphabetResolver) C() string {
  return "c"
}

type QueryResolver struct {}

func (r  *QueryResolver) Alphabet() AlphabetResolver {
  return AlphabetResolver{}
}

This causes the reflect.Value.Call() invocation to corrupt memory in go1.8.3 and go1.9.01.
Changing to the below fixes the zero-length return issue.

func (r  *QueryResolver) Alphabet() (*AlphabetResolver, error) {
  return &AlphabetResolver{}, nil
}

@dmitshur
Copy link

dmitshur commented Sep 28, 2017

This causes the reflect.Value.Call() invocation to corrupt memory in go1.8.3 and go1.9.1.

Did you mean Go 1.9.0 or 1.9.1? If the latter, is this a different issue than golang/go#21717? Is it already reported?

@tonyghita
Copy link
Member Author

tonyghita commented Sep 30, 2017

Ah sorry, I meant go1.9.0. The fix looks slated for the 1.9.1 milestone.

If you wanted to be safe in the meantime, you can build go from source and cherry-pick 0a48185b4383fac8d260112efa261112f3d41ee2 onto the release you're using.

@dmitshur
Copy link

dmitshur commented Oct 2, 2017

Thanks for confirming that it's not an issue in 1.9.1.

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