# Connection timed out problem

**URL:** <https://discuss.elastic.co/t/connection-timed-out-problem/248905>\
**Category:** APM\
**Tags:** java\
**Created:** [September 17, 2020, 2:53am UTC](https://discuss.elastic.co/t/connection-timed-out-problem/248905 "2020-09-17T02:53:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bob96589](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@bob96589](https://discuss.elastic.co/u/bob96589)\
**Post date:** [September 17, 2020, 2:53am UTC](https://discuss.elastic.co/t/connection-timed-out-problem/248905/1 "2020-09-17T02:53:16Z")

</div>

**Kibana version** : 7.4.1

**Elasticsearch version** : 7.4.1

**APM Server version** : 7.6.1

**APM Agent language and version** : java  
[https://apm-ci.elastic.co/blue/organizations/jenkins/apm-agent-java%2Fapm-agent-java-mbp/detail/PR-1326/1/artifacts/](https://apm-ci.elastic.co/blue/organizations/jenkins/apm-agent-java%2Fapm-agent-java-mbp/detail/PR-1326/1/artifacts/)

**elasticapm.properties**

> environment=twtpehswj2ui01  
> application\_packages=com.delta  
> server\_urls=[http://10.148.208.47:8090](http://10.148.208.47:8090)  
> log\_level=TRACE  
> log\_file=_AGENT\_HOME_/../logs/elastic-apm.log  
> log\_file\_size=10mb  
> server\_timeout=0

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:

Sometime it receives apm data correctly, but there are time periods that can not receive the data (there are empty spaces in the chart below). And then I check the log (attached below). It says "Connection timed out".

But I try to hit [http://10.148.208.47:8090/intake/v2/events](http://10.148.208.47:8090/intake/v2/events) by postman and it response 202. So I think connection is not a problem.

Any suggestion how to fix the problem?  
Thanks.

**Apm view in Kibana**

 ![error](https://us1.discourse-cdn.com/elastic/original/3X/c/2/c25ed8c949ef1340d0a3448cd8781497081f9bf2.png)

**Error log**

```
2020-09-17 08:57:58,900 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type TRANSACTION with this error: Connection timed out (Connection timed out)
2020-09-17 09:12:32,628 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type METRICS with this error: Connection timed out (Connection timed out)
2020-09-17 09:14:39,860 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type METRICS with this error: Connection timed out (Connection timed out)
2020-09-17 09:16:48,116 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type METRICS with this error: Connection timed out (Connection timed out)
2020-09-17 09:18:59,571 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type METRICS with this error: Connection timed out (Connection timed out)

```

**Entire log**

> <https://gist.github.com/bob96589/3b4d017218e48041da98f242fa6ec65c>

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [September 17, 2020, 7:08am UTC](https://discuss.elastic.co/t/connection-timed-out-problem/248905/2 "2020-09-17T07:08:27Z")

</div>

From this line in the logs, it seems that you have a very optimistic timeout for server connection `0s`, which probably explains why do you get so much `Connection timed out` errors. Can you try with a value higher than zero like `1s` or with the default one (`5s`) ? Also, please note that this value should have a unit and is not just a number.

> [@bob96589](#):
>
> `2020-09-17 08:55:25,565 [main] DEBUG co.elastic.apm.agent.configuration.StartupInfo - server_timeout: '0s' (source: /usr/local/tomcat/lib/elasticapm.properties)`

---

<div class="post-metadata">

**Author:** ![bob96589](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@bob96589](https://discuss.elastic.co/u/bob96589)\
**Post date:** [September 18, 2020, 12:56am UTC](https://discuss.elastic.co/t/connection-timed-out-problem/248905/3 "2020-09-18T00:56:21Z")

</div>

Hi,

Previously, I've tried to set server\_timeout to 5s and 60s. And the problem still exists.

And then I found a post.

> If a request to the APM server takes longer than the configured timeout, the request is cancelled and the event (exception or transaction) is discarded. **Set to 0 to disable timeouts**.

That's why I tried to set server\_timeout to zero and without unit. I want to disable the timeout functionality. But it seems that this can not solve the problem.

> **[Reporter configuration options | APM Java Agent Reference \[1.x\] | Elastic](https://www.elastic.co/guide/en/apm/agent/java/current/config-reporter.html#config-server-timeout)**

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [September 21, 2020, 7:28am UTC](https://discuss.elastic.co/t/connection-timed-out-problem/248905/4 "2020-09-21T07:28:41Z")

</div>

Hi @bob96589,

Could you check in your server logs during the time frame where no data appears to be sent ?

If there is no visible activity during those time frames, it means the agent might not have been able to reach the server at all, which would indicate more a network issue rather than an issue with the agent. Increasing log level server-side might be required.

I assume that you only have a single apm-server instance, and thus my hypotheses are the following:

- if you have a single agent, if there is nothing in server logs after increasing log level, that means there is an issue on the network
- if you have more than one agent, if there is nothing in server logs, the issue is still on the network, but more on the server side (as no other agent seem able to reach it)
- if you have more than one agent and some of them are able to reach the server, that means the issue might be on the network on agent side, or that there is a bug in the agent.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 12, 2020, 3:28am UTC](https://discuss.elastic.co/t/connection-timed-out-problem/248905/5 "2020-10-12T03:28:45Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
