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

Stack overflow on validate_executable for fragment cycles #543

Closed
gmac opened this issue May 3, 2023 · 1 comment
Closed

Stack overflow on validate_executable for fragment cycles #543

gmac opened this issue May 3, 2023 · 1 comment
Assignees
Labels
apollo-compiler issues/PRs pertaining to semantic analysis & validation bug Something isn't working
Milestone

Comments

@gmac
Copy link

gmac commented May 3, 2023

Description

The following fails with a fatal runtime error: stack overflow...

let source = r#"
   { ...fragA }
   fragment fragA on Query { ...fragA }
"#;
let mut compiler = apollo_compiler::ApolloCompiler::new();
let file_id = compiler.add_executable(source, "");
compiler.db.validate_executable(file_id);

Interestingly, this only happens when the fragment spread is the initial selection in both scopes. Either of these permutations where the spread is preceded by another selection avoids the stack overflow:

{ sfoo ...fragA }
fragment fragA on Query { ...fragA }

Or...

{ ...fragA }
fragment fragA on Query { sfoo ...fragA }

Steps to reproduce

See snippet above.

Expected result

Should get an error rather than a stack overflow.

Actual result

Stack overflow.

Environment

  • Operating system and version: macos, 13.3.1
  • Shell (bash/zsh/powershell): zsh
  • apollo-rs crate: apollo-compiler
  • Crate version: 0.8.0
@gmac gmac added bug Something isn't working triage labels May 3, 2023
@goto-bus-stop goto-bus-stop self-assigned this May 9, 2023
@goto-bus-stop goto-bus-stop added apollo-compiler issues/PRs pertaining to semantic analysis & validation and removed triage labels May 9, 2023
@goto-bus-stop goto-bus-stop added this to the [email protected] milestone May 9, 2023
@lrlna
Copy link
Member

lrlna commented May 25, 2023

fixed in #544 & #552

@lrlna lrlna closed this as completed May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apollo-compiler issues/PRs pertaining to semantic analysis & validation bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants