Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robovm app crashes if gc triggered and there are >=256 threads #583

Open
guillerodriguez opened this issue May 17, 2021 · 0 comments
Open

Comments

@guillerodriguez
Copy link

guillerodriguez commented May 17, 2021

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.

@guillerodriguez guillerodriguez changed the title Robovm app crashes if gc triggered and there are more than 256 threads Robovm app crashes if gc triggered and there are >=256 threads May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant