#2847 WebClient configuration

Wesley Wed 23 Jun 2021

Hi all,

Recently I have been struggling with alot of request timeouts when using the WebClient class while trying to connect to the REST API of TheThingsNetwork V3.

I am not very sure what causes it, but the problem seems to be originating from the WebClient. When trying out different approaches (Java&OkHttp, cURL and Postman) they all work without a problem.

To explain what happens: All requests made through other means take about 1 to 5 seconds (the response bodies are quite large in size), but when run through the WebClient it takes at least 3 minutes to complete.

I did increase the receiveTimeout Socket Option to 5min, otherwise I encounter a java.net.SocketTimeoutException with the message Read timed out after the request has been made.

Is it possible a certain option is enabled by default that can cause this to happen?

Every bit of help would be appreciated!

Thanks in advance,


brian Wed 23 Jun 2021

I would image you are using TLS? If so then its almost certainly something in that stack

The WebClient code is really simple, we might start by putting some debug lines in there to see the text going over the wire (or a wireshark capture might be illuminating)

Wesley Wed 23 Jun 2021

I am not very good at understanding Wireshark, but I noticed a TCP RST packet being sent to the endpoint host when my software throws an exception, after which the endpoint responds with a [FIN, ACK] packet (close connection I believe?), which is then followed up by me sending another TCP RST packet.

Wesley Wed 23 Jun 2021

Worked through the issue with Matthew. The problem was a Header that should not have been set.

Thanks for the help!

(topic can be closed!)

Login or Signup to reply.