Skip to content

Fix servlet exception accessing inputstream before the application #242

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

Merged
merged 3 commits into from
Jan 25, 2021

Conversation

pavolloffay
Copy link
Member

This fixes accessing request inputstream/reader before the application for async requests. In other words the instrumentation could access input stream before the application - especially for async response.

This fixes the issue, however the instrumentation still tries to access the streams even though the application might not read the body at all. In the follow-up PR I will try to add a check to read the stream only if the app accessed it.

2021-01-25 05:35:34.391 [GraphQLServlet-4] INFO  g.k.s.HttpRequestHandlerImpl - Bad request: cannot create invocation input parser

java.lang.IllegalStateException: STREAMED

	at org.eclipse.jetty.server.Request.getReader(Request.java:1178) ~[jetty-server-9.4.30.v20200611.jar:9.4.30.v20200611]

	at graphql.kickstart.servlet.GraphQLPostInvocationInputParser.getGraphQLInvocationInput(GraphQLPostInvocationInputParser.java:33) ~[graphql-java-servlet-10.0.0.jar:?]

	at graphql.kickstart.servlet.HttpRequestHandlerImpl.handle(HttpRequestHandlerImpl.java:36) ~[graphql-java-servlet-10.0.0.jar:?]

	at graphql.kickstart.servlet.AbstractGraphQLHttpServlet.doRequest(AbstractGraphQLHttpServlet.java:148) ~[graphql-java-servlet-10.0.0.jar:?]

	at graphql.kickstart.servlet.AbstractGraphQLHttpServlet.lambda$doRequestAsync$2(AbstractGraphQLHttpServlet.java:136) ~[graphql-java-servlet-10.0.0.jar:?]

	at io.opentelemetry.javaagent.instrumentation.api.concurrent.RunnableWrapper.run(RunnableWrapper.java:28) [?:0.9.1]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]

	at java.lang.Thread.run(Unknown Source) [?:?]

Signed-off-by: Pavol Loffay p.loffay@gmail.com

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
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

Successfully merging this pull request may close these issues.

1 participant