graphql-java-kickstart/graphql-java-tools

Large schema file causes ParseCancelledException on start-up

AlasdairMacleanGlobal opened this issue · 2 comments

Description

After upgrading to version 12.0.0 of graphql-java-tools (and graphql-spring-boot-starter) large schema files fail to parse with an error:

Failed to instantiate [graphql.kickstart.tools.SchemaParser]: Factory method 'schemaParser' threw exception; nested exception is graphql.parser.ParseCancelledException: Invalid Syntax : More than 15000 parse tokens have been presented. To prevent Denial Of Service attacks, parsing has been cancelled. offending token '}' at line 4397 column 25

Expected behavior

Large schema files should be parsed without error.

Actual behavior

ParseCancelledException (see above)

Steps to reproduce the bug

  1. git clone https://github.com/graphql-java-kickstart/samples.git
  2. git checkout 49d2ee77610cd5fec22973f70e86aed42c66108a
  3. cd samples
  4. Edit gradle.properties:
LIB_GRAPHQL_SERVLET_VER=12.0.0
LIB_GRAPHQL_SPRING_BOOT_VER=12.0.0
LIB_GRAPHQL_TOOLS_VER=12.0.0
...
  1. Create a large graphqls file with at least 15000 tokens (actually 15000 lines x 4 tokens):
for i in {1..15000}; do echo "interface Example$i { }" >> tools-spring-boot/src/main/resources/large.graphqls; done
  1. Start Spring Boot service: ./gradlew :tools-spring-boot:bootRun
  2. Error occurs on start-up while parsing schema

Notes:

@AlasdairMacleanGlobal can you verify that this #610 solves your issue?

Looks good, thanks!