-
Notifications
You must be signed in to change notification settings - Fork 136
Closed
Description
Issue details
If the garbage collector kicks in and there are >= 256 threads alive, the application will crash.
This is due to the following check in bwdgc:
if (GC_mach_threads_count == GC_MAX_MACH_THREADS) // 256
ABORT("Too many threads");
This is a problem for two reasons:
- Cannot be easily handled by application code
- Behaviour is not obvious: an application can start >= 256 threads and that will not be a problem if the gc does not run
To avoid this I suggest that a check is added in Thread.start() and a RuntimeException
is thrown (or perhaps a VirtualMachineError
?) if that will exceed the 256 thread limit (note that this includes native threads).
This way at least the application will have a chance to capture the exception and perhaps do something useful with it.
bartekpacia
Metadata
Metadata
Assignees
Labels
No labels