# Query connection status when node fails

**URL:** <https://community.f5.com/t/query-connection-status-when-node-fails/29888>\
**Category:** Technical Forums\
**Tags:** dev, irules, devops, application-delivery\
**Created:** [April 25, 2013, 5:43pm UTC](https://community.f5.com/t/query-connection-status-when-node-fails/29888 "2013-04-25T17:43:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jimmy\_Orkin\_437](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@Jimmy\_Orkin\_437](https://community.f5.com/u/Jimmy_Orkin_437)\
**Post date:** [April 25, 2013, 5:43pm UTC](https://community.f5.com/t/query-connection-status-when-node-fails/29888/1 "2013-04-25T17:43:02Z")

</div>

I am new to iRules. I am writting an iRule to track and limit connections to nodes. The connections are UDP. I am logging information about the connections in the SERVER\_CLOSED event.

When the node fails and SERVER\_CLOSED is called, My references to IP::client\_addr and UDP::client\_port cause a TCL error listed below:

TCL error: /Common/sgng-count-policing-v2.0 - no clientside connection established (line 8) invoked from within “IP::client\_addr”

The runtime error is causing my tracking counts to get out of sync with reality.

Is there a way for me to determine that the connection is not valid so that I can avoid my references to IP::client\_addr and UDP::client\_port so that I do not get a runtime TCL error?

Thanks,

Jimmy

---

<div class="post-metadata">

**Author:** ![Jimmy\_Orkin\_437](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@Jimmy\_Orkin\_437](https://community.f5.com/u/Jimmy_Orkin_437)\
**Post date:** [April 25, 2013, 6:20pm UTC](https://community.f5.com/t/query-connection-status-when-node-fails/29888/2 "2013-04-25T18:20:55Z")

</div>

I figured a way out my problem. I now understand the lifetime of the variables and that they live between events. I will store the data I need from the SERVER\_CONNECTED event.

I still would like to know what commands can be called in the SERVER\_CLOSED event when the session goes down abnormally.

Thanks,

Jimmy

---

<div class="post-metadata">

**Author:** ![What\_Lies\_Bene1](https://avatars.discourse-cdn.com/v4/letter/w/59ef9b/32.png) [@What\_Lies\_Bene1](https://community.f5.com/u/What_Lies_Bene1)\
**Post date:** [April 26, 2013, 9:47am UTC](https://community.f5.com/t/query-connection-status-when-node-fails/29888/3 "2013-04-26T09:47:09Z")

</div>

I don’t think there is a way of detecting when a session is closed normally or otherwise unfortunately. I’d love to be corrected if anyone knows better?

---

<div class="post-metadata">

**Author:** ![Colin\_Walker\_12](https://avatars.discourse-cdn.com/v4/letter/c/a88e4f/32.png) [@Colin\_Walker\_12](https://community.f5.com/u/Colin_Walker_12)\
**Post date:** [April 26, 2013, 5:59pm UTC](https://community.f5.com/t/query-connection-status-when-node-fails/29888/4 "2013-04-26T17:59:05Z")

</div>

We have no solid way of knowing whether or not a connection was closed “properly”, for the most part. All we see is a session termination, usually, and that triggers our closed event(s) to fire. Unless you are doing some very specific analysis and interrogation of the session in flight, you probably won’t be able to tell what is a “proper” close vs. an error.

Colin
