Skip to content

Commit a70fa54

Browse files
WIP
1 parent 7c0b5f2 commit a70fa54

6 files changed

Lines changed: 9 additions & 40 deletions

File tree

.github/workflows/test-external.yaml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ jobs:
4343
bundler-cache: true
4444

4545
- name: Run tests
46-
timeout-minutes: 10
47-
run: bundle exec sus --verbose
46+
timeout-minutes: 1
47+
run: CONSOLE_LEVEL=debug bundle exec sus --verbose test/async/container/controller.rb:200

fixtures/async/container/controllers/bad.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
require_relative "../../../../lib/async/container/controller"
88

9+
current_sigint = Signal.trap(:INT){$stderr.puts("---INT---", caller_locations); Thread.main.raise(Interrupt)}
10+
current_sigterm = Signal.trap(:TERM){Thread.main.raise(Interrupt)}
11+
Console.info(self, "Traps were:", sigint: current_sigint, sigterm: current_sigterm)
12+
913
$stdout.sync = true
1014

1115
class Bad < Async::Container::Controller

lib/async/container/controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def run(signals: Async::Signals.default)
309309
end
310310
end
311311
rescue Interrupt
312-
self.stop(false)
312+
# Ignore - normal shutdown - can propagate from top level Sync.
313313
end
314314
end
315315
end

lib/async/container/forked.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ def self.fork(**options)
104104
# Fork from `Thread.new` so the child does not inherit the parent fiber scheduler or the current caller's fiber stack. Only this short-lived thread is copied into the child process:
105105
::Thread.new do
106106
::Process.fork do
107-
# Convert process signals into pending interrupts on the surviving fork thread so they respect `Thread.handle_interrupt` in the child:
108-
::Signal.trap(:INT){::Thread.current.raise(::Interrupt)}
109-
::Signal.trap(:TERM){::Thread.current.raise(::Interrupt)}
110-
111107
# Reset interrupt masking - `Exception` is a fast path:
112108
::Thread.handle_interrupt(Exception => :immediate) do
113109
yield Instance.for(process)

test/async/container/controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,11 @@ def controller.setup(container)
200200
it "fails to start" do
201201
expect(input.gets).to be == "Ready...\n"
202202

203+
$stderr.puts "Sending SIGINT to #{process_id}..."
203204
Process.kill(:INT, process_id)
204205

205206
# It was killed:
207+
$stderr.puts "Waiting for killed..."
206208
expect(input.gets).to be_nil
207209
end
208210
end

0 commit comments

Comments
 (0)