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

Read Timeout with Graphql extension #11076

Closed
Neisuz opened this issue Jul 30, 2020 · 15 comments
Closed

Read Timeout with Graphql extension #11076

Neisuz opened this issue Jul 30, 2020 · 15 comments
Labels
area/graphql area/smallrye kind/bug Something isn't working triage/needs-feedback We are waiting for feedback.

Comments

@Neisuz
Copy link

Neisuz commented Jul 30, 2020

Describe the bug
i've got the simple project where i use Rest approach.
When i add quarkus-smallrye-graphql extension and execute the request via Rest approach where i have to deserialize the body i got this ->

Failed to handle request: java.io.IOException: Read timeout
	at io.undertow.vertx.VertxHttpExchange.readBlocking(VertxHttpExchange.java:453)
	at io.undertow.server.HttpServerExchange.readBlocking(HttpServerExchange.java:937)
	at io.undertow.servlet.spec.ServletInputStreamImpl.readIntoBuffer(ServletInputStreamImpl.java:178)
	at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:158)
	at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:144)
	at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1025)
	at org.apache.commons.io.IOUtils.copy(IOUtils.java:999)
	at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:218)
	at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:312)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:456)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:417)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:391)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:68)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:488)
	at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:259)
	at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:160)
	at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
	at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:163)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:245)
	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:249)
	at io.quarkus.resteasy.runtime.ResteasyFilter.doFilter(ResteasyFilter.java:30)
	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
	at io.undertow.websockets.jsr.JsrWebSocketFilter.doFilter(JsrWebSocketFilter.java:160)
	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
	at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
	at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:63)
	at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
	at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:67)
	at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:133)
	at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
	at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:65)
	at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
	at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
	at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
	at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:247)
	at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:56)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:111)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:108)
	at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
	at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
	at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$10$1.call(UndertowDeploymentRecorder.java:565)
	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
	at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:152)
	at io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:43)
	at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$1.handleRequest(UndertowDeploymentRecorder.java:113)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:290)
	at io.undertow.server.DefaultExchangeHandler.handle(DefaultExchangeHandler.java:18)
	at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$6$1.run(UndertowDeploymentRecorder.java:396)
	at io.quarkus.runtime.CleanableExecutor$CleaningRunnable.run(CleanableExecutor.java:231)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
	at java.base/java.lang.Thread.run(Thread.java:834)
	at org.jboss.threads.JBossThread.run(JBossThread.java:479)

probably where it stucks ->

    public static byte[] toByteArray(InputStream input) throws IOException {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        copy(input, output);
        return output.toByteArray();
    }

Expected behavior
(Describe the expected behavior clearly and concisely.)
Graphql extension shoudn't affect the behavior of the Rest

Actual behavior
up.

Configuration
1.5.2.Final or 1.6.1.Final - the same behavior.
Java 11

@Neisuz Neisuz added the kind/bug Something isn't working label Jul 30, 2020
@quarkusbot
Copy link

/cc @phillip-kruger, @jmartisk

@phillip-kruger
Copy link
Member

Hi @Neisuz - Do you have a small project that recreate this issue so that I can have a look ?
Also see this example that use both REST and GraphQL: https://github.com/phillip-kruger/graphql-example/tree/master/quarkus-example

@jmartisk
Copy link
Contributor

jmartisk commented Aug 3, 2020

Yeah I guess we will need to see the code, from the stack trace I'm not sure how GraphQL is involved, this looks like a normal REST call, but for some reason it times out on reading the body (?). Also it seems that you're using Undertow, I'd suggest trying to switch to Vert.x for the web layer. I'm not completely sure if the GraphQL extension can run with Undertow.

@spr1ng
Copy link

spr1ng commented Aug 5, 2020

This causes the issue:

<dependency>
     <groupId>io.quarkus</groupId>
     <artifactId>quarkus-undertow-websockets</artifactId>
</dependency>

@phillip-kruger
Copy link
Member

@stuartwdouglas might be able to help here then.

@Neisuz
Copy link
Author

Neisuz commented Aug 28, 2020

any update?

@stuartwdouglas
Copy link
Member

You probably need to change quarkus.http.read-timeout, which defaults to 60s. If graphql is expecting to be able to read from the client until the client sends it something then you will likely want something a lot larger.

Something that is weird is that the resteasy stack trace does not seem to line up with the sources.

@Neisuz
Copy link
Author

Neisuz commented Aug 31, 2020

You probably need to change quarkus.http.read-timeout, which defaults to 60s. If graphql is expecting to be able to read from the client until the client sends it something then you will likely want something a lot larger.

Something that is weird is that the resteasy stack trace does not seem to line up with the sources.

Nope, it does not work. The issue still exists and if a project contains this dependency, it does not allow REST to do "POST, UPDATE..."(as an example) with Graphql.

<dependency>
     <groupId>io.quarkus</groupId>
     <artifactId>quarkus-undertow-websockets</artifactId>
</dependency>

@Neisuz
Copy link
Author

Neisuz commented Sep 1, 2020

@phillip-kruger, hello, i added some code to your project where you can see what the reason of this issue.

@phillip-kruger
Copy link
Member

@stuartwdouglas - this is a very weird scenario - What is being read it a REST service (not GraphQL) - and that is where the timeout occur. You don't even need any GraphQL code, but if you add GraphQL and undertow to a JAX-RS project that use InputStream as parameter on a POST, it hangs. As soon as you remove either of the GraphQL or undertow extension, it works. I am not sure what is happening.

@stuartwdouglas
Copy link
Member

It would be the combination of the RequireBodyHandlerBuildItem + Undertow. Undertow must not handle requests that have been through the body handler correctly.

@stuartwdouglas
Copy link
Member

Actually there was already a bug about this (#5959) and it should be fixed, so I am not 100% sure what is happening.

@Neisuz
Copy link
Author

Neisuz commented Sep 16, 2020

anything new?

@geoand
Copy link
Contributor

geoand commented Sep 13, 2024

Is this still an issue?

@geoand geoand added the triage/needs-feedback We are waiting for feedback. label Sep 13, 2024
@geoand
Copy link
Contributor

geoand commented Sep 27, 2024

Closing for lack of feedback

@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/graphql area/smallrye kind/bug Something isn't working triage/needs-feedback We are waiting for feedback.
Projects
None yet
Development

No branches or pull requests

7 participants