[External] : Re: Dropped task -- feature or bug?

Brian S O'Neill bronee at gmail.com
Tue May 17 13:42:37 UTC 2022

A virtual thread which is blocked with a timeout performs some form of 
registration, does it not? Is there an expectation that virtual threads 
are more likely to be blocked with infinite timeouts, and that this 
blocking is frequent enough that the registration step is too costly?

Perhaps it would make sense to add an option (system property) that 
would enable registration when a virtual thread is blocked, as a 
debugging tool?

On 2022-05-17 12:11 AM, Ron Pressler wrote:
> It is by design — virtual threads are lightweight objects; like 
> HashMaps, we don’t maintain a registry of all instances — and this 
> behaviour is described in JEP 425. If you create a thread that could 
> become unreachable, it also *probably* means that nothing is awaiting 
> its result and that nothing would notice if it had an uncaught 
> exception, i.e. you’re doing something risky and specialised, so we 
> don’t want to add a registration mechanism in such specialised uses. (I 
> say “probably” because you could join a thread without holding a 
> reference to it, but you’d be without any means of interrupting it).

More information about the loom-dev mailing list