trinodb / trino-gateway

https://trinodb.github.io/trino-gateway/
Apache License 2.0
147 stars 65 forks source link

Make HTTP request body re-readable via HttpServletRequest #452

Closed JeongDaeKim closed 4 weeks ago

JeongDaeKim commented 1 month ago

After https://github.com/trinodb/trino-gateway/issues/41, request body can't be accessible via HttpServletRequest in any modules, such as TrinoQueryProperties, routing rules, and gateway itself, because HttpServletRequest input stream(HttpServletRequest.getInputStream()) is consumed already by Jakarta web service framework.

2024-08-26T08:42:06.498+0900    ERROR   http-worker-89  io.trino.gateway.ha.router.RuleReloadingRoutingGroupSelector    Error opening rules configuration file, using routing group header as default.
java.lang.IllegalStateException: STREAMED
        at org.eclipse.jetty.ee10.servlet.ServletApiRequest.getReader(ServletApiRequest.java:1169)
        at io.trino.gateway.ha.router.TrinoQueryProperties.processRequestBody(TrinoQueryProperties.java:109)
        at io.trino.gateway.ha.router.TrinoQueryProperties.<init>(TrinoQueryProperties.java:103)
        at io.trino.gateway.ha.router.RuleReloadingRoutingGroupSelector.findRoutingGroup(RuleReloadingRoutingGroupSelector.java:98)
        at io.trino.gateway.ha.handler.RoutingTargetHandler.getBackendFromRoutingGroup(RoutingTargetHandler.java:84)
        at io.trino.gateway.ha.handler.RoutingTargetHandler.lambda$getRoutingDestination$0(RoutingTargetHandler.java:64)
        at java.base/java.util.Optional.orElseGet(Optional.java:364)
        at io.trino.gateway.ha.handler.RoutingTargetHandler.getRoutingDestination(RoutingTargetHandler.java:64)
        at io.trino.gateway.proxyserver.RouteToBackendResource.postHandler(RouteToBackendResource.java:66)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
Chaho12 commented 1 month ago

This should be fixed in next release

ram-agg commented 4 weeks ago

@Chaho12 when is the next release planned?

JeongDaeKim commented 4 weeks ago

https://github.com/trinodb/trino-gateway/pull/426 duplicate

Chaho12 commented 4 weeks ago

@ram-agg not sure but i hope soon :)