Ephemeral threads

Alex Miller alex at puredanger.com
Sat Jan 10 15:55:05 UTC 2026


What is the likely future of the trackAllThreads flag?

> On Jan 10, 2026, at 9:43 AM, Alan Bateman <alan.bateman at oracle.com> wrote:
> 
> On 10/01/2026 11:04, Andrew Haley wrote:
>> :
>> 
>> Maybe it's waiting on some kind of semaphore that has become unreachable. In that case, the thread cannot make any progress. It makes no difference whether you GC it or not. The native resources it holds will never be released. Semantically, an unreachable thread is not a thing: it has no properties.
>> 
>> Therefore, any thread that is unreachable may be GC'd, surely.
>> 
>> I guess I may be missing some way that an unreachable thread is observable? If so, what is it?
>> 
> Diagnosing resource leaks, semaphore permit "leaks" etc. is much harder if threads can be GC'ed before they terminate.
> 
> We looked into the implications of ephemeral threads a few years ago. Aside from being fragile to use, they lead to issues that range from mildly spooky to truly horrifying. Think of cleaners running when objects are in inconsistent state. Think of objects with finalizers that put a "goodbye" element to a queue and cause a thread to come back from the dead. There's a lot more to this. The summary is that introducing ephemeral threads has huge implications due to the interactions with so many parts of the system. We decided not to spend further time on it.
> 
> -Alan
> 


More information about the loom-dev mailing list