Connection reset in log when using undertow behind haproxy

101 Views Asked by At

I have undertow server (2.3.2) which runs on ubuntu server behind haproxy 2.6.15. This is reproducible with all default settings on haproxy so I didn't change any timeouts or settings.

  • When I call some endpoint on rest server, if I do it directly over rest server http://localhost:12345/api/getSomeData, there is only debug message in log ~1 minute after request was made (Timing out idle connection)

     2023-12-04 09:10:54,688 INFO  [XNIO-1 task-2] testutils.RestApi - com.test.utils.testutils.RestApi (RestApi.java:64) - Getting user
      2023-12-04 09:12:01,524 DEBUG [XNIO-1 I/O-3] protocol.ParseTimeoutUpdater - io.undertow.request
    (ParseTimeoutUpdater.java:151) - Timing out idle connection from
    /[0:0:0:0:0:0:0:1]:55438
    
  • When I call same endpoint over haproxy which is redirecting it to undertow http server (http://localhost/api/getSomeData) I get debug in log with exception stack trace. This is probably not concerning, but I can't find anywhere what is the cause (timeout setting on haproxy) causing it. This is printed in log exactly 15 seconds after http call

 2023-12-04 09:01:45,046 INFO  [XNIO-1 task-2] testutils.RestApi -
 com.test.utils.testutils.RestApi (RestApi.java:64) - Getting user 
 2023-12-04 09:02:00,770 DEBUG [XNIO-1 I/O-6] http.HttpReadListener -
 io.undertow.request.io (HttpReadListener.java:160) - Error reading
 request  java.net.SocketException: Connection reset  at
 sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:401)
 ~[?:?]   at
 sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:434) ~[?:?]
  at org.xnio.nio.NioSocketConduit.read(NioSocketConduit.java:289)
 ~[xnio-nio-3.8.8.Final.jar:3.8.8.Final]  at
 org.xnio.conduits.ConduitStreamSourceChannel.read(ConduitStreamSourceChannel.java:127)
 ~[xnio-api-3.8.8.Final.jar:3.8.8.Final]  at
 io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:158)
 [undertow-core-2.3.2.Final.jar:2.3.2.Final]  at
 io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136)
 [undertow-core-2.3.2.Final.jar:2.3.2.Final]  at
 io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:59)
 [undertow-core-2.3.2.Final.jar:2.3.2.Final]  at
 org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
 [xnio-api-3.8.8.Final.jar:3.8.8.Final]   at
 org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
 [xnio-api-3.8.8.Final.jar:3.8.8.Final]   at
 org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
 [xnio-nio-3.8.8.Final.jar:3.8.8.Final]   at
 org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
 [xnio-nio-3.8.8.Final.jar:3.8.8.Final]
0

There are 0 best solutions below