Skip to content

Executor threads not being created as daemon #817

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

Closed
headius opened this issue Aug 7, 2019 · 3 comments · Fixed by #840
Closed

Executor threads not being created as daemon #817

headius opened this issue Aug 7, 2019 · 3 comments · Fixed by #840
Labels
bug A bug in the library or documentation. high-priority Should be done ASAP.

Comments

@headius
Copy link
Contributor

headius commented Aug 7, 2019

There appears to be an executor service somewhere in concurrent-ruby that's not marking the threads as "daemon" on JVM. As a result, this causes that executor to keep the process from terminating.

This issue has been affecting builds of JRuby for some time; the CRuby standard library test suite we run appears to trigger concurrent-ruby to create this executor, resulting in the entire suite hanging at the end when it should gracefully shut down.

jruby/jruby#5718 (comment)

I am not sure where the code is for launching such an executor...someone else might be able to find this quickly. I will try.

@headius
Copy link
Contributor Author

headius commented Aug 7, 2019

@headius
Copy link
Contributor Author

headius commented Aug 7, 2019

@pitr-ch pitr-ch added bug A bug in the library or documentation. high-priority Should be done ASAP. labels Aug 24, 2019
@headius
Copy link
Contributor Author

headius commented Sep 12, 2019

If I can get some help on this I'd be happy to put together a PR. Do I have the right places above?

fzakaria added a commit to fzakaria/concurrent-ruby that referenced this issue Jan 8, 2020
Introduce a ThreadFactory that will set `Thread#setDaemon` according
to the _auto_terminate_ value.

This makes the need for the `AtExit` functionality uneeded since all
threads can now be started daemonized.

Furthermore, the gross **hack** of `Configuration#disable_at_exit_handlers!`
is especially not needed since this allows the JVM to properly terminate
even with minitest.

You can test this with:
```
ruby test/concurrent/executor/test_cached_thread_pool.rb
```

fixes ruby-concurrency#839
fixes ruby-concurrency#817
fzakaria added a commit to fzakaria/concurrent-ruby that referenced this issue Jan 14, 2020
Introduce a ThreadFactory that will set `Thread#setDaemon` according
to the _auto_terminate_ value.

This makes the need for the `AtExit` functionality uneeded since all
threads can now be started daemonized.

Furthermore, the gross **hack** of `Configuration#disable_at_exit_handlers!`
is especially not needed since this allows the JVM to properly terminate
even with minitest.

You can test this with:
```
ruby test/concurrent/executor/test_cached_thread_pool.rb
```

fixes ruby-concurrency#839
fixes ruby-concurrency#817
pitr-ch pushed a commit to fzakaria/concurrent-ruby that referenced this issue Jan 19, 2020
Introduce a ThreadFactory that will set `Thread#setDaemon` according
to the _auto_terminate_ value.

This makes the need for the `AtExit` functionality uneeded since all
threads can now be started daemonized.

Furthermore, the gross **hack** of `Configuration#disable_at_exit_handlers!`
is especially not needed since this allows the JVM to properly terminate
even with minitest.

You can test this with:
```
ruby test/concurrent/executor/test_cached_thread_pool.rb
```

fixes ruby-concurrency#839
fixes ruby-concurrency#817
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug in the library or documentation. high-priority Should be done ASAP.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants