HTTP error response: Client 'https://api.openchargemap.io': Error occurred reading HTTP response: Connection reset by peer

Hello Christopher,

I hope this message finds you well. We’ve been encountering an intermittent issue with our microservice application on AWS that utilizes your API for obtaining POIs.

The error we’re experiencing is related to reading the HTTP response, specifically encountering a “Connection reset by peer” error. It appears only on the second repeated request after some period of inactivity from the first successful request.


[m[36m2023-08-21 10:33:57,720 DEBUG netty.DefaultHttpClient:1745 4dafe20c249d3118 - Sending HTTP GET to https://api.openchargemap.io/v3/poi?latitude=42.29913999326527&longitude=-83.69916999712586&distance=500.0&distanceunit=km&maxresults=20&output=json&client=Harman+Online+Search
[m[30m2023-08-21 10:33:57,720 TRACE netty.DefaultHttpClient:84 4dafe20c249d3118 - X-API-Key: MASKED
[m[30m2023-08-21 10:33:57,721 TRACE netty.DefaultHttpClient:84 4dafe20c249d3118 - Accept: application/json
[m[30m2023-08-21 10:33:57,721 TRACE netty.DefaultHttpClient:84 4dafe20c249d3118 - X-B3-TraceId: 4dafe20c249d3118
[m[30m2023-08-21 10:33:57,721 TRACE netty.DefaultHttpClient:84 4dafe20c249d3118 - X-B3-SpanId: 487d9cd61215f703
[m[30m2023-08-21 10:33:57,721 TRACE netty.DefaultHttpClient:84 4dafe20c249d3118 - X-B3-ParentSpanId: 4dafe20c249d3118
[m[30m2023-08-21 10:33:57,721 TRACE netty.DefaultHttpClient:84 4dafe20c249d3118 - X-B3-Sampled: 1
[m[30m2023-08-21 10:33:57,721 TRACE netty.DefaultHttpClient:84 4dafe20c249d3118 - host: api.openchargemap.io
[m[30m2023-08-21 10:33:57,723 TRACE netty.DefaultHttpClient:2032 - HTTP Client exception (Connection reset by peer) occurred for request : GET https://api.openchargemap.io/v3/poi?latitude=42.29913999326527&longitude=-83.69916999712586&distance=500.0&distanceunit=km&maxresults=20&output=json&client=Harman+Online+Search
Aug 21, 2023 10:33:57 AM brave.Tracing$LogSpanHandler end
INFO: {“traceId”:“4dafe20c249d3118”,“parentId”:“4dafe20c249d3118”,“id”:“487d9cd61215f703”,“kind”:“CLIENT”,“name”:“GET”,“timestamp”:1692614037719657,“duration”:4293,“localEndpoint”:{“serviceName”:“application”,“ipv4”:“10.144.19.22”},“remoteEndpoint”:{“serviceName”:“https://api.openchargemap.io”},“tags”:{“http.method”:“GET”,“http.path”:“/v3/poi”,“error”:“Client ‘https://api.openchargemap.io’: Error occurred reading HTTP response: Connection reset by peer”}}
[m[1;31m2023-08-21 10:33:57,724 ERROR interceptor.HttpClientIntroductionAdvice:380 4dafe20c249d3118 - Client [com.harman.search.ep.ecs.ocm.OpenChargeServiceApi] received HTTP error response: Client ‘https://api.openchargemap.io’: Error occurred reading HTTP response: Connection reset by peer
io.micronaut.http.client.exceptions.HttpClientException: Client ‘https://api.openchargemap.io’: Error occurred reading HTTP response: Connection reset by peer
at io.micronaut.http.client.netty.DefaultHttpClient$BaseHttpResponseHandler.exceptionCaught(DefaultHttpClient.java:2042)
at io.micronaut.http.client.netty.DefaultHttpClient$FullHttpResponseHandler.exceptionCaught(DefaultHttpClient.java:2292)
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:346)
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:325)
at io.netty.channel.AbstractChannelHandlerContext.fireExceptionCaught(AbstractChannelHandlerContext.java:317)
at io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught(ChannelInboundHandlerAdapter.java:143)
at io.netty.handler.codec.http2.Http2ConnectionHandler.exceptionCaught(Http2ConnectionHandler.java:582)
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:346)
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:325)
at io.netty.channel.AbstractChannelHandlerContext.fireExceptionCaught(AbstractChannelHandlerContext.java:317)
at io.netty.handler.ssl.SslHandler.exceptionCaught(SslHandler.java:1115)
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:346)
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:325)
at io.netty.channel.AbstractChannelHandlerContext.fireExceptionCaught(AbstractChannelHandlerContext.java:317)
at io.netty.channel.DefaultChannelPipeline$HeadContext.exceptionCaught(DefaultChannelPipeline.java:1377)
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:346)
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:325)
at io.netty.channel.DefaultChannelPipeline.fireExceptionCaught(DefaultChannelPipeline.java:907)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.handleReadException(AbstractNioByteChannel.java:125)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:177)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
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(Unknown Source)
Caused by: java.io.IOException: Connection reset by peer
at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at java.base/sun.nio.ch.SocketDispatcher.read(Unknown Source)
at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
at java.base/sun.nio.ch.IOUtil.read(Unknown Source)
at java.base/sun.nio.ch.IOUtil.read(Unknown Source)
at java.base/sun.nio.ch.SocketChannelImpl.read(Unknown Source)
at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:256)
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)

Given your expertise, could you kindly provide insights into diagnosing and resolving this matter? We suspect it could be related to network or AWS environment fluctuations.

Your guidance would be invaluable in resolving this issue. Thank you for your assistance.

Best regards,
Oleksandr Ziuzko

Hi, our API sits behind a Cloudflare web application firewall and it’s possible something is triggering their request throttling system however you should also make sure your HTTP User Agent is set to a non-blank value as the API will reject such a request.

That’s not particularly new though, so if this has suddenly started to happen then it could either be an intermittent fault or something that’s changed on your side.

There was another reported issue with the iOS app, so I’ve restarted our main API server just in case that helps.