# \[Heartbeat\] clarify “context deadline exceeds” further

**URL:** <https://discuss.elastic.co/t/heartbeat-clarify-context-deadline-exceeds-further/274305>\
**Category:** Beats\
**Tags:** heartbeat\
**Created:** [May 28, 2021, 8:51am UTC](https://discuss.elastic.co/t/heartbeat-clarify-context-deadline-exceeds-further/274305 "2021-05-28T08:51:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lowry](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lowry/32/77489_2.png) [@lowry](https://discuss.elastic.co/u/lowry)\
**Post date:** [May 28, 2021, 8:51am UTC](https://discuss.elastic.co/t/heartbeat-clarify-context-deadline-exceeds-further/274305/1 "2021-05-28T08:51:15Z")

</div>

It is learned that Heartbeat employs Golang context to manage the session to do the http check, Getting “context deadline exceeds” error message while accessing a target timeout.

However, there’re 2 different cases would cause timeout:

1. The target host is unpingable, for example:

```auto
ping -q -c 1 <faked host>
PING <faked host> (<faked host>) 56(84) bytes of data.
--- <faked host> ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
$ time telnet <faked host>
Trying <faked host>...
telnet: Unable to connect to remote host: Connection timed out
real	2m9.623s

```

1. The port that the specific service is listening but response is very slow.

Wondering if there’s a way to distinguish these 2 kinds of cases?

---

<div class="post-metadata">

**Author:** ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)\
**Post date:** [June 7, 2021, 11:05pm UTC](https://discuss.elastic.co/t/heartbeat-clarify-context-deadline-exceeds-further/274305/2 "2021-06-07T23:05:47Z")

</div>

I'm a bit confused here because one of these tests uses ICMP, while the other uses TCP. In the fact that they are the same error message but on different protocols. In both cases a request was sent and no result was received. It is the same error just with a different protocol.

Can you tell us more about your use case and why you need to distinguish between them?

---

<div class="post-metadata">

**Author:** ![lowry](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lowry/32/77489_2.png) [@lowry](https://discuss.elastic.co/u/lowry)\
**Post date:** [June 24, 2021, 9:53am UTC](https://discuss.elastic.co/t/heartbeat-clarify-context-deadline-exceeds-further/274305/3 "2021-06-24T09:53:31Z")

</div>

@Andrew_Cholakian1

Hello Andrew,  
Sorry for confusing you.  
What I’m asking here is assuming there’s a case that `context deadline exceeds` happened for a url check, we’re wondering to know the exact reason:

1. caused by the target host is unreachable
2. or the target host is reachable but the target port is irresponsible.

Hope I make it clearly this time.

---

<div class="post-metadata">

**Author:** ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)\
**Post date:** [June 25, 2021, 2:36am UTC](https://discuss.elastic.co/t/heartbeat-clarify-context-deadline-exceeds-further/274305/4 "2021-06-25T02:36:18Z")

</div>

Hey @lowry, those are kind of the same thing, and also kind of different. So there are two cases where connections don't complete:

1. The connection is 'refused' via a TCP RST packet
2. The connection times out because the other side doesn't respond, or a network issue

In the second case we cannot determine if the machine is up, all we know is that we asked for info and we got no response. This [stack overflow question](https://serverfault.com/questions/725262/what-causes-the-connection-refused-message) has an excellent top answer going into detail why this is so.

---

<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:** [July 23, 2021, 4:36am UTC](https://discuss.elastic.co/t/heartbeat-clarify-context-deadline-exceeds-further/274305/5 "2021-07-23T04:36:39Z")

</div>

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