I have a Java 8
Spring Boot
service.
It is hosted on AWS
, in Kubernetes v1.13
, Docker v18.06.3-ce
.
Yesterday for 10 or even more hours I had a bunch of intermittent UnknownHostExceptions
when trying to send http
requests from my service to both internal and external services.
The exception happened at least for 5 different host names.
Today I had no issues.
In the service logs I can not find anything other than something like this:
java.net.UnknownHostException: example.com
Also, not sure if it is relevant, but the service is using Spring Boot
Apache Camel v2.22.0
to send these requests. Here is a piece of code which sends them:
Exchange exchange = template.send(url, exchange1 -> {
exchange1.getIn().setHeaders(headers);
exchange1.getIn().setHeader(Exchange.HTTP_METHOD, httpMethod.toString());
exchange1.getIn().setBody(body);
});
Mvn
dependencies for Apache Camel
:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot</artifactId>
<version>${apache.camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>${apache.camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-stream</artifactId>
<version>${apache.camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${apache.camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-script</artifactId>
<version>${apache.camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http4</artifactId>
<version>${apache.camel.version}</version>
</dependency>
Any ideas what can be the cause of these intermittent UnknownHostExceptions
? Please let me know what pieces of info would be helpful to find out the root cause of the issue.
P.S. Service was working fine for more than a year. No recent code changes. At least for this logic above.