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

Router hangs when loading a Parseable but invalid supergraph schema if the telemetry plugin is enabled #847

Closed
o0Ignition0o opened this issue Apr 13, 2022 · 0 comments · Fixed by #849
Assignees
Labels

Comments

@o0Ignition0o
Copy link
Contributor

It turns out loading a super graph that contains validation errors will fail on the Router service builder (as expected). However when the telemetry plugin is enabled the router will hang.

Steps to reproduce:

  • Make this change in ./examples/graphql/local.graphql:
diff --git a/examples/graphql/local.graphql b/examples/graphql/local.graphql
index 04295346..969ff1c1 100644
--- a/examples/graphql/local.graphql
+++ b/examples/graphql/local.graphql
@@ -39,7 +39,7 @@ type Product
   inStock: Boolean @join__field(graph: INVENTORY)
   name: String @join__field(graph: PRODUCTS)
   price: Int @join__field(graph: PRODUCTS)
-  reviews: [Review] @join__field(graph: REVIEWS)
+  reviews: [Review] @join__field(graph: PRODUCTS)
   reviewsForAuthor(authorID: ID!): [Review] @join__field(graph: REVIEWS)
   shippingEstimate: Int @join__field(graph: INVENTORY, requires: "price weight")
   upc: String! @join__field(graph: PRODUCTS)
  • Run the router with telemetry enabled:
$ cargo r -- -c ./examples/telemetry/otlp.router.yaml -s ./examples/graphql/local.graphql
  • Expected: The router fails to start
  • Actual: The router hangs, it takes a kill -9 to get the shell back

Notice not providing -c will not set up telemetry and show an error instead such as:

$ cargo r -- -s ./examples/graphql/local.graphql
    Finished dev [unoptimized + debuginfo] target(s) in 0.43s
     Running `target/debug/router -s ./examples/graphql/local.graphql`
2022-04-13T16:26:41.753124Z  INFO apollo_router::executable: apollo-router@0.1.0-preview.4
2022-04-13T16:26:41.805521Z  INFO apollo_router: starting Apollo Router
2022-04-13T16:26:42.475415Z ERROR apollo_router::state_machine: cannot create the router: couldn't build Router Service: query planning had errors: bridge errors: UNKNOWN: Cannot find type Review in subgraph products
2022-04-13T16:26:42.475559Z  INFO apollo_router: stopped with error
2022-04-13T16:26:42.475706Z ERROR apollo_router::executable: could not create the HTTP pipeline: couldn't build Router Service: query planning had errors: bridge errors: UNKNOWN: Cannot find type Review in subgraph products
could not create the HTTP pipeline: couldn't build Router Service: query planning had errors: bridge errors: UNKNOWN: Cannot find type Review in subgraph products
@o0Ignition0o o0Ignition0o self-assigned this Apr 13, 2022
o0Ignition0o added a commit that referenced this issue Apr 13, 2022
fixes #847

The telemetry plugin would cause the router to hang if ServiceBuilder::build() failed.
This commit makes sure the Telemetry plugin is cleanly shutdown when it's the case, thus correctly erroring out instead of hanging.
@BrynCooke BrynCooke removed the triage label Apr 13, 2022
@BrynCooke BrynCooke modified the milestone: v0.1.0-preview.5 Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants