# URScript Thread Cleanup

**URL:** <https://forum.universal-robots.com/t/urscript-thread-cleanup/42377>\
**Category:** URScript\
**Created:** [March 6, 2026, 2:53am UTC](https://forum.universal-robots.com/t/urscript-thread-cleanup/42377 "2026-03-06T02:53:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mat.elwarth](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@mat.elwarth](https://forum.universal-robots.com/u/mat.elwarth)\
**Post date:** [March 6, 2026, 2:53am UTC](https://forum.universal-robots.com/t/urscript-thread-cleanup/42377/1 "2026-03-06T02:53:11Z")

</div>

Hi Forum,

I spawn a URScript thread in the installation node of my program that sends joint positions to a daemon over a socket. I also have a check in my thread to see if the socket connection failed.

When I power on my robot and run a program, the socket communication works well. However, when I end the program then start a new one, I just get the socket connection failure message. I’m not sure what is causing this. Is the issue because I never explicitly kill the thread? Or does this come from another source?  
I can put my thread in a program node, start it, write children, then kill, and that works fine.

Thanks for your help,  
Mattis
