Skip to content

Commit

Permalink
Remove unnecessary SIGINT trap for Jruby (#1961)
Browse files Browse the repository at this point in the history
See #1868

The original intent of the trap was to ensure that the socket was removed
properly. It now does, so the trap is no longer necessary.
  • Loading branch information
nateberkopec committed Sep 11, 2019
1 parent ddc1d8d commit 7aa7757
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
6 changes: 0 additions & 6 deletions lib/puma/launcher.rb
Expand Up @@ -424,12 +424,6 @@ def setup_signals

begin
Signal.trap "SIGINT" do
if Puma.jruby?
@status = :exit
graceful_stop
exit
end

stop
end
rescue Exception
Expand Down
17 changes: 17 additions & 0 deletions test/test_integration_single.rb
Expand Up @@ -67,4 +67,21 @@ def test_term_not_accepts_new_connections
@server.close unless @server.closed?
@server = nil # prevent `#teardown` from killing already killed server
end

def test_int_signal_with_background_thread_in_jruby
skip_unless :jruby

cli_server('test/rackup/hello.ru')
begin
sock = TCPSocket.new(HOST, @tcp_port)
sock.close
rescue => ex
fail("Port didn't open properly: #{ex.message}")
end

Process.kill :INT, @server.pid
Process.wait @server.pid

assert_raises(Errno::ECONNREFUSED) { TCPSocket.new(HOST, @tcp_port) }
end
end

0 comments on commit 7aa7757

Please sign in to comment.