Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Query times out with missing variable #758

Open
SPahooja opened this issue Dec 10, 2021 · 1 comment
Open

Query times out with missing variable #758

SPahooja opened this issue Dec 10, 2021 · 1 comment
Labels

Comments

@SPahooja
Copy link

SPahooja commented Dec 10, 2021

Describe the bug
Executing a query excepting an argument, times out in case the query is run with an undefined variable without reaching the resolver when using the AsyncTaskDecorator solution to enable async execution

Schema Example

extend type Query {
    countries(filter: CountryFilter!): [Country!]!
}

Query:

query Test($filter: CountryFilter!){
  countries(filter: $filter) {
    id
  }
}

Response:

{
  "errors": [
    {
      "message": "Execution canceled because timeout was reached",
      "locations": []
    }
  ],
  "data": null
}
Exception in thread "graphql-exec-2" graphql.execution.NonNullableValueCoercedAsNullException: Variable 'filter' has coerced Null value for NonNull type 'CountryFilter!'
	at graphql.execution.ValuesResolver.externalValueToInternalValueForVariables(ValuesResolver.java:407)
	at graphql.execution.ValuesResolver.coerceVariableValues(ValuesResolver.java:94)
	at graphql.analysis.QueryTraverser.coerceVariables(QueryTraverser.java:64)
	at graphql.analysis.QueryTraverser.<init>(QueryTraverser.java:60)
	at graphql.analysis.QueryTraverser.<init>(QueryTraverser.java:40)
	at graphql.analysis.QueryTraverser$Builder.build(QueryTraverser.java:297)
	at graphql.analysis.MaxQueryDepthInstrumentation.newQueryTraverser(MaxQueryDepthInstrumentation.java:92)
	at graphql.analysis.MaxQueryDepthInstrumentation.lambda$beginValidation$2(MaxQueryDepthInstrumentation.java:57)
	at graphql.execution.instrumentation.SimpleInstrumentationContext.onCompleted(SimpleInstrumentationContext.java:51)
	at graphql.execution.instrumentation.ChainedInstrumentation$ChainedInstrumentationContext.lambda$onCompleted$1(ChainedInstrumentation.java:238)
	at graphql.com.google.common.collect.ImmutableList.forEach(ImmutableList.java:405)
	at graphql.execution.instrumentation.ChainedInstrumentation$ChainedInstrumentationContext.onCompleted(ChainedInstrumentation.java:238)
	at graphql.GraphQL.validate(GraphQL.java:600)
	at graphql.GraphQL.parseAndValidate(GraphQL.java:562)
	at graphql.GraphQL.lambda$parseValidateAndExecute$10(GraphQL.java:531)
	at graphql.execution.preparsed.NoOpPreparsedDocumentProvider.getDocument(NoOpPreparsedDocumentProvider.java:15)
	at graphql.GraphQL.parseValidateAndExecute(GraphQL.java:533)
	at graphql.GraphQL.executeAsync(GraphQL.java:502)
	at graphql.kickstart.execution.GraphQLInvoker.executeAsync(GraphQLInvoker.java:37)
	at graphql.kickstart.execution.GraphQLInvoker.execute(GraphQLInvoker.java:28)
	at graphql.kickstart.servlet.HttpRequestInvokerImpl.invoke(HttpRequestInvokerImpl.java:164)
	at graphql.kickstart.servlet.HttpRequestInvokerImpl.lambda$invokeAndHandleAsync$2(HttpRequestInvokerImpl.java:79)

Expected behavior
Return an error about the missing variable

@SPahooja SPahooja added the bug label Dec 10, 2021
@stengvac
Copy link

stengvac commented Jan 17, 2022

Seems also broken for parameter parsing Exception in thread "graphql-exec-2" graphql.schema.CoercingParseValueException: UUID string too large also lead to timeout.

Exception in thread "graphql-exec-2" graphql.schema.CoercingParseValueException: UUID string too large
	at somepackage.libs.graphql.scalar.UUIDScalar$Convertor.parseValue(UUIDScalar.kt:34)
	at somepackage.libs.graphql.scalar.UUIDScalar$Convertor.parseLiteral(UUIDScalar.kt:43)
	at somepackage.libs.graphql.scalar.UUIDScalar$Convertor.parseLiteral(UUIDScalar.kt:19)
	at graphql.validation.ValidationUtil.parseLiteral(ValidationUtil.java:121)
	at graphql.validation.ValidationUtil.isValidLiteralValue(ValidationUtil.java:93)
	at graphql.validation.ValidationUtil.isValidLiteralValue(ValidationUtil.java:89)
	at graphql.validation.ValidationUtil.isValidLiteralValue(ValidationUtil.java:150)
	at graphql.validation.ValidationUtil.isValidLiteralValue(ValidationUtil.java:106)
	at graphql.validation.ValidationUtil.isValidLiteralValue(ValidationUtil.java:89)
	at graphql.validation.rules.ArgumentsOfCorrectType.checkArgument(ArgumentsOfCorrectType.java:28)
	at graphql.validation.RulesVisitor.checkArgument(RulesVisitor.java:99)
	at graphql.validation.RulesVisitor.enter(RulesVisitor.java:66)
	at graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:33)
	at graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:38)
	at graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:38)
	at graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:38)
	at graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:38)
	at graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:38)
	at graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:38)
	at graphql.validation.LanguageTraversal.traverse(LanguageTraversal.java:28)
	at graphql.validation.Validator.validateDocument(Validator.java:65)
	at graphql.ParseAndValidate.validate(ParseAndValidate.java:62)
	at graphql.GraphQL.validate(GraphQL.java:598)
	at graphql.GraphQL.parseAndValidate(GraphQL.java:562)
	at graphql.GraphQL.lambda$parseValidateAndExecute$10(GraphQL.java:531)
	at graphql.execution.preparsed.NoOpPreparsedDocumentProvider.getDocument(NoOpPreparsedDocumentProvider.java:15)
	at graphql.GraphQL.parseValidateAndExecute(GraphQL.java:533)
	at graphql.GraphQL.executeAsync(GraphQL.java:502)
	at graphql.kickstart.execution.GraphQLInvoker.executeAsync(GraphQLInvoker.java:37)
	at graphql.kickstart.execution.GraphQLInvoker.execute(GraphQLInvoker.java:28)
	at graphql.kickstart.servlet.HttpRequestInvokerImpl.invoke(HttpRequestInvokerImpl.java:164)
	at graphql.kickstart.servlet.HttpRequestInvokerImpl.lambda$invokeAndHandleAsync$2(HttpRequestInvokerImpl.java:79)
	at org.springframework.cloud.sleuth.instrument.async.TraceRunnable.run(TraceRunnable.java:63)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalArgumentException: UUID string too large
	at java.base/java.util.UUID.fromString(UUID.java:199)
	at somepackage.libs.graphql.scalar.UUIDScalar$Convertor.parseValue(UUIDScalar.kt:32)
	... 35 more
{"@timestamp":"2022-01-17T14:09:27.972Z","message":"GraphQL execution canceled because timeout of 30000 millis was reached. The following query was being executed when this happened:\nmutation {\n  sendTestPush {\n    customTextNotification(input: {\n      title: \"title\"\n      body: \"nice body. moooo 2\"\n      userId: \"49ba4ea7-34fa-4c53-a595-2515a1acb0aer\"\n    }) {\n      traceId\n      notificationType\n      tokens {\n        iosTokens\n        androidTokens \n      }\n    }\n  }\n}","logger":"graphql.kickstart.servlet.HttpRequestInvokerImpl","level":"WARN"}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants