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

Concurrent::Promise.execute does not close the spawned thread #701

Closed
monterey01 opened this issue Mar 16, 2018 · 2 comments
Closed

Concurrent::Promise.execute does not close the spawned thread #701

monterey01 opened this issue Mar 16, 2018 · 2 comments
Labels
bug A bug in the library or documentation.

Comments

@monterey01
Copy link

monterey01 commented Mar 16, 2018


  • Operating system: l mac
  • concurrent-ruby version:concurrent-ruby (1.0.5 java)
  • concurrent-ruby-ext installed: no
  • concurrent-ruby-edge used: no
  • ruby versions tested - =* jruby-9.1.2.0 [ x86_64 ]( Our team uses this in production)
    ruby-2.2.5 [ x86_64 ](Same issue with native ruby)
require 'sinatra'
require 'concurrent'
configure { set :server, :puma }

$count=0

class Ticker
  def get_year_end_closing

    puts 'method 1 start'
    p Time.new.inspect
    sleep 10

    puts 'method 1 then'
    p Time.new.inspect
  end

  $ticker=Ticker.new

  def get_year_end_closing2

    puts 'method 2'
  end
end

get '/' do
  promise=Concurrent::Promise.execute{ $ticker.get_year_end_closing}
  return 'success'
end

I am having an issue with above code where Concurrent::Promise.execute does not close the spawned thread after get_year_end_closing is successfully executed.

I can't shutdown sinatra gracefully without killing the java process. Please let me know how to fix. Same issue is noticed if i use future. I want to chain based on the output of get_year_end_closing.

Please let me know how to fix.

@pitr-ch pitr-ch added this to the 1.0.6 milestone May 2, 2018
@pitr-ch pitr-ch added the bug A bug in the library or documentation. label May 2, 2018
@pitr-ch
Copy link
Member

pitr-ch commented May 2, 2018

That is strange, the global pool is set to auto-terminate on JRuby. It should shutdown gracefully, I'll investigate further.

@pitr-ch
Copy link
Member

pitr-ch commented May 23, 2018

For the next release I've rolled back all the Java implementations which were blocking, #717. That should help. You can test master or 1.0.6 when it's released. If it's not fixed please reopen.

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.
Projects
None yet
Development

No branches or pull requests

2 participants