spring-cloud / spring-cloud/spring-cloud-gateway
Unavailable downstream service results in HTTP 500
Open
Nobody has claimed this yet.
waiting-for-triage
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
When a downstream service is unavailable for whatever reason, HTTP 500 is emitted rather than 503, and an exception is thrown
io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed with error(-111): Connection refused: /127.0.0.1:8556
Caused by: java.net.ConnectException: finishConnect(..) failed with error(-111): Connection refused
at io.netty.channel.unix.Errors.newConnectException0(Errors.java:166) ~[netty-transport-native-unix-common-4.1.132.Final.jar!/:4.1.132.Final]
at io.netty.channel.unix.Errors.handleConnectErrno(Errors.java:131) ~[netty-transport-native-unix-common-4.1.132.Final.jar!/:4.1.132.Final]
at io.netty.channel.unix.Socket.finishConnect(Socket.java:359) ~[netty-transport-native-unix-common-4.1.132.Final.jar!/:4.1.132.Final]
at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.doFinishConnect(AbstractEpollChannel.java:715) ~[netty-transport-classes-epoll-4.1.132.Final.jar!/:4.1.132.Final]
at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.finishConnect(AbstractEpollChannel.java:692) ~[netty-transport-classes-epoll-4.1.132.Final.jar!/:4.1.132.Final]
at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.epollOutReady(AbstractEpollChannel.java:567) ~[netty-transport-classes-epoll-4.1.132.Final.jar!/:4.1.132.Final]
at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:491) ~[netty-transport-classes-epoll-4.1.132.Final.jar!/:4.1.132.Final]
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:399) ~[netty-transport-classes-epoll-4.1.132.Final.jar!/:4.1.132.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:998) ~[netty-common-4.1.132.Final.jar!/:4.1.132.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.132.Final.jar!/:4.1.132.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.132.Final.jar!/:4.1.132.Final]
at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]
SCG WebFlux 4.3.x
Similar issue observed when DNS resolution fails in case of DNS based routes in Kubernetes (service not published)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing Spring Cloud Gateway's WebFlux handling for downstream connection and DNS-resolution failures in the 4.3.x path. Reproduce a route with an unavailable downstream service, then verify that the response is HTTP 503 and no exception escapes as HTTP 500.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- api, backend, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100