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: stack overflow in case of incorrect recursive request #173

Open
gstarikov opened this issue Dec 28, 2021 · 0 comments
Open

Comments

@gstarikov
Copy link

Hi. have found endless recursion in case of incorrect graphql request. is there a way to prohibit that?

request:

query Streams {
  Streams {
    ...StreamFragment
  }
}

fragment StreamFragment on Stream {
  ID
  Streams {
    ...StreamFragment
    Streams {
      ...StreamFragment
      Streams {
        ...StreamFragment
      }
    }
  }
}

schema:

type Stream 
    ID: ID!
    Streams:          [Stream]
}

stack trace

runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc033200400 stack=[0xc033200000, 0xc053200000]
fatal error: stack overflow
runtime stack:
runtime.throw({0xddc55b, 0x147ad20})
        /usr/local/go/src/runtime/panic.go:1198 +0x71
runtime.newstack()
        /usr/local/go/src/runtime/stack.go:1088 +0x5ac
runtime.morestack()
        /usr/local/go/src/runtime/asm_amd64.s:461 +0x8b
goroutine 8 [running]:
runtime.heapBitsSetType(0xc05358ee50, 0x10, 0x10, 0xcb1b20)
        /usr/local/go/src/runtime/mbitmap.go:822 +0xbcc fp=0xc033200410 sp=0xc033200408 pc=0x415a0c
runtime.mallocgc(0x10, 0xcb1b20, 0x1)
        /usr/local/go/src/runtime/malloc.go:1100 +0x65e fp=0xc033200490 sp=0xc033200410 pc=0x40ccbe
runtime.growslice(0xcb1b20, {0x0, 0xc000020bc9, 0x2}, 0x30)
        /usr/local/go/src/runtime/slice.go:267 +0x4ea fp=0xc0332004f8 sp=0xc033200490 pc=0x44b1aa
github.com/vektah/gqlparser/v2/validator/rules.(*sequentialFieldsMap).Push(...)
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:160
github.com/vektah/gqlparser/v2/validator/rules.getFieldsAndFragmentNames.func1({0xc00038adc0, 0x3, 0xd51740})
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:544 +0x165 fp=0xc0332005b0 sp=0xc0332004f8 pc=0xbbd5c5
github.com/vektah/gqlparser/v2/validator/rules.getFieldsAndFragmentNames({0xc00038adc0, 0x3, 0x4})
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:554 +0xea fp=0xc033200620 sp=0xc0332005b0 pc=0xbbd40a
github.com/vektah/gqlparser/v2/validator/rules.(*overlappingFieldsCanBeMergedManager).collectConflictsBetweenFieldsAndFragment(0xc0001ab038, 0xc05a8d8678, 0x2, 0x100000000000000, 0xc00038ac>
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:282 +0xaa fp=0xc033200698 sp=0xc033200620 pc=0xbbbd2a
github.com/vektah/gqlparser/v2/validator/rules.(*overlappingFieldsCanBeMergedManager).findConflictsBetweenSubSelectionSets(0xc0001ab038, 0x0, {0xc000386c60, 0x1, 0x1}, {0xc00006a220, 0x2, 0>
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:360 +0x125 fp=0xc033200738 sp=0xc033200698 pc=0xbbc2c5
github.com/vektah/gqlparser/v2/validator/rules.(*overlappingFieldsCanBeMergedManager).findConflict(0xc0001ab038, 0xfe, 0xc000205e80, 0xc000205e00)
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:465 +0x4b5 fp=0xc0332007e8 sp=0xc033200738 pc=0xbbce15
github.com/vektah/gqlparser/v2/validator/rules.(*overlappingFieldsCanBeMergedManager).collectConflictsBetween(0xc00006a260, 0xc05a8d8660, 0x2, 0x10000000048a9ba, 0xc026dcdb80)
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:407 +0x179 fp=0xc0332008a8 sp=0xc0332007e8 pc=0xbbc879
github.com/vektah/gqlparser/v2/validator/rules.(*overlappingFieldsCanBeMergedManager).findConflictsBetweenSubSelectionSets(0xc0001ab038, 0x0, {0xc00006a220, 0x2, 0x2}, {0xc00006a260, 0x2, 0>
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:354 +0xfd fp=0xc033200948 sp=0xc0332008a8 pc=0xbbc29d
github.com/vektah/gqlparser/v2/validator/rules.(*overlappingFieldsCanBeMergedManager).findConflict(0xc0001ab038, 0x0, 0xc000205e00, 0xc000205d80)
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:465 +0x4b5 fp=0xc0332009f8 sp=0xc033200948 pc=0xbbce15
github.com/vektah/gqlparser/v2/validator/rules.(*overlappingFieldsCanBeMergedManager).collectConflictsBetween(0xd1d720, 0xc05a8d8648, 0x20, 0xc026dcdac0, 0xc026dcdac0)
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:407 +0x179 fp=0xc033200ab8 sp=0xc0332009f8 pc=0xbbc879
github.com/vektah/gqlparser/v2/validator/rules.(*overlappingFieldsCanBeMergedManager).collectConflictsBetweenFieldsAndFragment(0xc0001ab038, 0xc05a8d8648, 0x2, 0x10000000048a9ba, 0xc00038ad>
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:291 +0xf2 fp=0xc033200b30 sp=0xc033200ab8 pc=0xbbbd72
github.com/vektah/gqlparser/v2/validator/rules.(*overlappingFieldsCanBeMergedManager).findConflictsBetweenSubSelectionSets(0xc0001ab038, 0x0, {0xc000386c60, 0x1, 0x1}, {0xc00006a260, 0x2, 0>
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:367 +0x197 fp=0xc033200bd0 sp=0xc033200b30 pc=0xbbc337
github.com/vektah/gqlparser/v2/validator/rules.(*overlappingFieldsCanBeMergedManager).findConflict(0xc0001ab038, 0x0, 0xc000205e80, 0xc000205d80)
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:465 +0x4b5 fp=0xc033200c80 sp=0xc033200bd0 pc=0xbbce15
github.com/vektah/gqlparser/v2/validator/rules.(*overlappingFieldsCanBeMergedManager).collectConflictsBetween(0xd1d720, 0xc05a8d8630, 0x20, 0xc026dcd9a0, 0xc026dcd9a0)
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:407 +0x179 fp=0xc033200d40 sp=0xc033200c80 pc=0xbbc879
github.com/vektah/gqlparser/v2/validator/rules.(*overlappingFieldsCanBeMergedManager).collectConflictsBetweenFieldsAndFragment(0xc0001ab038, 0xc05a8d8630, 0x2, 0x100000000000000, 0xc00038ad>
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:291 +0xf2 fp=0xc033200db8 sp=0xc033200d40 pc=0xbbbd72
github.com/vektah/gqlparser/v2/validator/rules.(*overlappingFieldsCanBeMergedManager).findConflictsBetweenSubSelectionSets(0xc0001ab038, 0x0, {0xc000386c60, 0x1, 0x1}, {0xc00006a220, 0x2, 0>
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:367 +0x197 fp=0xc033200e58 sp=0xc033200db8 pc=0xbbc337
github.com/vektah/gqlparser/v2/validator/rules.(*overlappingFieldsCanBeMergedManager).findConflict(0xc0001ab038, 0xfe, 0xc000205e80, 0xc000205e00)
        /go/pkg/mod/github.com/vektah/gqlparser/[email protected]/validator/rules/overlapping_fields_can_be_merged.go:465 +0x4b5 fp=0xc033200f08 sp=0xc033200e58 pc=0xbbce15
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

1 participant