-
Notifications
You must be signed in to change notification settings - Fork 326
Support Async Timeout Property in GraphQLServletProperties #469
Comments
Thanks for this change, I stumbled upon this while trying to set the same thing. I'm in the process of trying to test the effect of the timeout, but I can't actually get it to timeout. I can't see any reference to this in the documentation, and looking at the code I can't see where this value gets used. Could someone point me in the right direction? |
I hope this helps you further?
|
Thanks @Thinkenterprise. I've got it being set there correctly, I just can't observe any change in behaviour. I'm not sure if there is something else I need to do. |
I am using graphql.servlet.async-timeout: properties in springboot project to set a request timeout. {
"timestamp": "2021-05-06T19:05:25.134+0000",
"status": 500,
"error": "Internal Server Error",
"message": "Server Error",
"path": "/graphql"
} which does not accurately describe that this is a timeout error. |
Try setting |
@theozaurus I have the same problem. I set the
After 40000 ms I get the result an no timout erros occurse!?? @dhitalsand It is a mystery to me why it works for you!? @oliemansm Do you know who is monitoring the timeout? |
@oliemansm @theozaurus I have an idea why the timeout has no effect. There is no listener that catches the timeout event and produces a corresponding cancellation and error message. Can this be?
|
@Thinkenterprise I think the |
Yes, I think the solution you suggested is also possible. However, the solution has the disadvantage that the timeout is no longer initiated by the servlet container, but by us. When we use an AsyncListener, the timeout comes from the servlet container. However, we would then have to stop the CompletableFuture via cancel (), which is not that easy, right? But as I said, I am also for the solution you proposed. I believe that this is the cleanest solution!! |
@Thinkenterprise @dhitalsand {
"errors": [
{
"message": "Timeout",
"locations": []
}
],
"data": null
} If you have any suggestions for a better or clearer message, now is the time. I've also tried to cancel the GraphQL future responsible for actually running the query. Unfortunately that future appears to be blocking surprisingly, and that's because of something in the Would be much better if we not only abort the request, but also can cancel the actual graphql execution. Otherwise I guess the server would still be vulnerable to a DOS attack by firing these queries that timeout, but still try to finish running in the background. |
@oliemansm I understand the problem and have already thought about it. But I think we now have an acceptable solution. That was still a lot that you only had to change because of the timeout, thank you !! If you still ask about the error message: It would be great if you could also put the context information such as path or |
@Thinkenterprise I was actually mistaken about Verified that I can in fact now cancel the graphql execution, but that means some further refactoring to make it all work properly. I can't include context information like |
|
@oliemansm I already thought that it would not be easy to get the context information. Therefore the error message is completely ok. I understood about the CompletableStage etc. I think the refactoring effort is too high for the benefit. You can put that on another release. From my point of view, the issue can be closed. |
@Thinkenterprise i actually already refactored it, so it's already supported now if you use the 11.1.1-SNAPSHOT version of GraphQL-Java-servlet |
Release in 11.1.0 |
Would it be possible to add the attribute
asyncTimeout
in theGraphQLServletProperties
so that the `GraphQLWebAutoConfigurationcan load it to the
GraphQLConfiguration``? So that it is possible to set a request timeout for each query. This was introduced in GraphQL Servlet in 9.2, but cannot be configured in Spring Boot. However, that would be very helpful to ward off malicious queries.The text was updated successfully, but these errors were encountered: