# Kapacitor UDF over socket: socket write error

**URL:** <https://community.influxdata.com/t/kapacitor-udf-over-socket-socket-write-error/1609>\
**Category:** Kapacitor\
**Tags:** kapacitor\
**Created:** [July 12, 2017, 11:30pm UTC](https://community.influxdata.com/t/kapacitor-udf-over-socket-socket-write-error/1609 "2017-07-12T23:30:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![manojm321](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@manojm321](https://community.influxdata.com/u/manojm321)\
**Post date:** [July 12, 2017, 11:30pm UTC](https://community.influxdata.com/t/kapacitor-udf-over-socket-socket-write-error/1609/1 "2017-07-12T23:30:18Z")

</div>

Hello,

I have a UDF talking to Kapacitor over unix domain socket. My “accepter” is exactly similar to the one explained in “The Server” section of the tutorial here: [Writing a socket based UDF | InfluxData Documentation Archive](https://docs.influxdata.com/kapacitor/v0.13/examples/socket_udf/#the-server)

Once the server creates the connection I wait for agent.Wait() function to return in a go thread, similar to the tutorial but the socket seems to have been closed and I get “use of closed network connection”

There are no errors in my agent interface implementation, It is interesting that this started to happen after I added some more logic to Point function of Agent interface. According to logs my UDF took about 1sec to process a point. Is that too long?

Let me know if you need more info.

System:  
Influx : Enterprise version 1.2.4  
Kapacitor: 1.2.0

---

<div class="post-metadata">

**Author:** ![manojm321](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@manojm321](https://community.influxdata.com/u/manojm321)\
**Post date:** [July 13, 2017, 1:57am UTC](https://community.influxdata.com/t/kapacitor-udf-over-socket-socket-write-error/1609/2 "2017-07-13T01:57:20Z")

</div>

Update:

Some times I see this error as well:

$ kapacitor show test  
ID: test  
Error: myUDF: stopping UDF server: keepalive timedout, last keepalive received was: 2017-07-13 01:01:03.055723295 +0000 UTC

From the code in udf/server.go It looks like there is some keepalive timeout. Can some one explain how this works?

---

<div class="post-metadata">

**Author:** ![manojm321](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@manojm321](https://community.influxdata.com/u/manojm321)\
**Post date:** [July 27, 2017, 5:10pm UTC](https://community.influxdata.com/t/kapacitor-udf-over-socket-socket-write-error/1609/3 "2017-07-27T17:10:53Z")

</div>

Looks like the solution was to increase the timeout for UDF in kapacitor.conf
