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

Forwarding to static page results in errors #2950

Closed
YaniM opened this issue May 10, 2023 · 5 comments
Closed

Forwarding to static page results in errors #2950

YaniM opened this issue May 10, 2023 · 5 comments
Assignees
Labels
Milestone

Comments

@YaniM
Copy link

YaniM commented May 10, 2023

Hello,
We have the following setup, which forwards to static page located in resource:

spring:
  cloud:
    gateway:
      routes:
      - id: docs
        uri: forward:/docs.html
        predicates:
        - Path=/docs

It was okay for spring-cloud-starter-gateway:3.0.1, but after migrating to the latest (spring-cloud-starter-gateway:4.0.5) we get the following error:

WARN 457951 --- [or-http-epoll-7] reactor.core.Exceptions                  : throwIfFatal detected a jvm fatal exception, which is thrown and logged below:

java.lang.StackOverflowError: null
   at reactor.core.publisher.FluxPeekFuseable$PeekConditionalSubscriber.currentContext(FluxPeekFuseable.java:765)
   at reactor.core.publisher.InnerOperator.currentContext(InnerOperator.java:33)
   at reactor.core.publisher.InnerOperator.currentContext(InnerOperator.java:33)
   at reactor.core.publisher.InnerOperator.currentContext(InnerOperator.java:33)
   at reactor.core.publisher.InnerOperator.currentContext(InnerOperator.java:33)
   at reactor.core.publisher.InnerOperator.currentContext(InnerOperator.java:33)
   at reactor.core.publisher.InnerOperator.currentContext(InnerOperator.java:33)
   at reactor.core.publisher.InnerOperator.currentContext(InnerOperator.java:33)
   at reactor.core.publisher.InnerOperator.currentContext(InnerOperator.java:33)
   at reactor.core.publisher.FluxConcatMap$ConcatMapInner.currentContext(FluxConcatMap.java:847)
   at reactor.core.publisher.InnerOperator.currentContext(InnerOperator.java:33) 

ERROR 457951 --- [or-http-epoll-7] reactor.netty.http.server.HttpServer     : [5a76359f-1, L:/[0:0:0:0:0:0:0:1%0]:9887 - R:/[0:0:0:0:0:0:0:1%0]:38924] 

DEBUG java.lang.IllegalStateException: Spec. Rule 2.12 - Subscriber.onSubscribe MUST NOT be called more than once (based on object equality)
   at reactor.core.Exceptions.duplicateOnSubscribeException(Exceptions.java:196)
   at reactor.core.publisher.Operators.reportSubscriptionSet(Operators.java:1121)
   at reactor.core.publisher.Operators.setOnce(Operators.java:1226)
   at reactor.netty.channel.ChannelOperations.onSubscribe(ChannelOperations.java:270)
   at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onSubscribe(MonoPeekTerminal.java:152)
   at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onSubscribe(MonoPeekTerminal.java:152)
   at reactor.core.publisher.Operators.reportThrowInSubscribe(Operators.java:226)
   at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:71)
   at reactor.core.publisher.MonoDeferContextual.subscribe(MonoDeferContextual.java:55)
   at reactor.netty.http.server.HttpServer$HttpServerHandle.onStateChange(HttpServer.java:1006)
   at reactor.netty.ReactorNetty$CompositeConnectionObserver.onStateChange(ReactorNetty.java:710)
   at reactor.netty.transport.ServerTransport$ChildObserver.onStateChange(ServerTransport.java:477)
   at reactor.netty.http.server.HttpServerOperations.onInboundNext(HttpServerOperations.java:633)
   at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:113)
   at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
   at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
   at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
   at reactor.netty.http.server.HttpTrafficHandler.channelRead(HttpTrafficHandler.java:228)
   at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
   at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
   at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
   at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
   at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
   at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
   at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
   at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
   at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
   at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
   at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
   at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
   at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
   at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
   at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800)
   at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:499)
   at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:397)
   at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
   at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
   at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
   at java.base/java.lang.Thread.run(Thread.java:833)

Errors are not very meaningful to us to understand if some additional configuration is required.
Any help is appreciated, thanks !

As a workaround:
#1339 where StaticFilesFilter is implemented.

@howardem
Copy link

howardem commented Jun 16, 2023

Hi @spencergibb, @violetagg and @ryanjbaxter we are facing the same issue in our Spring Cloud Gateway. Our implementation is using Spring Boot 2.7.12 and Spring Cloud 2021.0.7 running on Java 11. This issue has also been reported by @YaniM in #2979.

Is the Spring Cloud team actively working on finding a solution for this pressing bug? Any help would be appreciated!

@howardem
Copy link

In our case, we encountered the problem after we migrated to Spring Boot 2.7.12, Spring Cloud 2021.0.7 and Spring Cloud Gateway 3.1.7. We didn't have this issue in our previous implementation using this stack:

  • Spring Cloud Gateway 3.1.1
  • Spring Boot 2.6.6
  • Spring Cloud 2021.0.1
  • Java 11

@spencergibb
Copy link
Member

spencergibb commented Jun 19, 2023

This commit 18e116c is the cause.

A fix was made in the circuit breaker filter for this exact same error 91b465a.

Will need to come up with a general solution for any attributes added/used by predicates that need to be cleaned up later. /cc @ryanjbaxter

@howardem
Copy link

@spencergibb thank you so much for quickly finding the root cause for this issue. Do you have a tentative date in mind when the version 2021.0.8 will be available for the Spring Cloud Release Train?

Thanks in advance!

@spencergibb
Copy link
Member

See https://github.com/spring-cloud/spring-cloud-release/milestones?direction=asc&sort=due_date&state=open

So next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Status: Done
Development

No branches or pull requests

3 participants