# Thread Stopping by Itself?

**URL:** <https://forum.xojo.com/t/thread-stopping-by-itself/88046>\
**Category:** Bugs and Feature Requests\
**Created:** [April 8, 2026, 3:44pm UTC](https://forum.xojo.com/t/thread-stopping-by-itself/88046 "2026-04-08T15:44:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lawrence\_Johnson](https://forum.xojo.com/letter_avatar_proxy/v4/letter/l/87869e/32.png) [@Lawrence\_Johnson](https://forum.xojo.com/u/Lawrence_Johnson)\
**Post date:** [April 8, 2026, 3:44pm UTC](https://forum.xojo.com/t/thread-stopping-by-itself/88046/1 "2026-04-08T15:44:14Z")

</div>

From what I’ve read in the documentation, this isn’t supposed to be possible. Yet I have a situation where a Thread just seems to stop by itself:

The basic code in my thread run event is:

```auto
// Loop through received packets
Do
  
  // Wait for next packet
  Do Until udp.PacketsAvailable > 0
    thr.Sleep(1)
  Loop
  
  // Read Datagram
  dim dg as Datagram = udp.Read
  
  // Parse Packet
  ParsePacket(dg)
  
Loop

```

This should effectively run as an infinite loop that sleeps until UDP datagrams arrive on a socket and then passes them to the ParsePacket method for further processing. However, after about 5 secs of running everything seems to stop. I check the debugger and the Thread state is showing as “NotRunning”, despite there being no code that would have stopped the thread intentionally.

Does anyone know if there’s anything else I can look for that might cause a thread to break silently like this?

This was tested on Xojo 2025r2

---

<div class="post-metadata">

**Author:** ![DerkJ](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@DerkJ](https://forum.xojo.com/u/DerkJ)\
**Post date:** [April 9, 2026, 6:46am UTC](https://forum.xojo.com/t/thread-stopping-by-itself/88046/2 "2026-04-09T06:46:59Z")

</div>

Sockets run on the main thread. But i don’t see an issue here.
