feign.RetryableException: Connection reset executing POST

4.8k Views Asked by At

I'm calling a url from an external server and in 5% of cases I get this problem. i get java.net.SocketException: Broken pipe, my doubt is if the problem is in my application or the external service that for some reason is canceling the request

i`m using kotlin + spring boot + feign client

feign.RetryableException: Connection reset executing POST https://xpto.com/test // real url omitted
    at feign.FeignException.errorExecuting(FeignException.java:249)
    at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:129)
    at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:89)
    at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:100)
    at com.sun.proxy.$Proxy228.create(Unknown Source)
    at com.creditas.b2bapi.infrastructure.adapter.BcrediAdapter.createLead(BcrediAdapter.kt:22)
    at com.creditas.b2bapi.service.LeadBcrediService.createBcrediLead(LeadBcrediService.kt:44)
    at com.creditas.b2bapi.service.LeadBcrediService$$FastClassBySpringCGLIB$$a7c46a37.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:687)
    ... 142 common frames omitted
    Suppressed: java.net.SocketException: Broken pipe
        at java.base/sun.nio.ch.NioSocketImpl.implWrite(NioSocketImpl.java:421)
        at java.base/sun.nio.ch.NioSocketImpl.write(NioSocketImpl.java:441)
        at java.base/sun.nio.ch.NioSocketImpl$2.write(NioSocketImpl.java:825)
        at java.base/java.net.Socket$SocketOutputStream.write(Socket.java:1007)
        at java.base/sun.security.ssl.SSLSocketOutputRecord.encodeAlert(SSLSocketOutputRecord.java:82)
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:355)
        ... 166 common frames omitted
Caused by: java.net.SocketException: Connection reset
    at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:324)
    at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:351)
    at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:802)
    at java.base/java.net.Socket$SocketInputStream.read(Socket.java:937)
    at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:450)
    at java.base/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:68)
    at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1409)
    at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:1022)
    ... 162 common frames omitted
1

There are 1 best solutions below

0
kmiiloberrio-dev On

I also came across this type of error, my solution was to change the jdk I was using and the exception disappeared! So I don't really know the root of the problem, but changing jdk works for me. You can try using the JDKs provided by intellij. This article can be of great help. https://www.jetbrains.com/help/idea/sdk.html#jdk