Class: HotCell::Fixtures::Uninterruptible

Inherits:
Operation
  • Object
show all
Defined in:
lib/hot_cell/test_operations.rb

Overview

Pins the worker where Ruby cannot interrupt it.

A deadline test built on sleep passes against a self-enforcing implementation that could never work in production, because Timeout raises at an interrupt checkpoint and a thread inside a C extension does not reach one until it returns. libvips is the real case. Deferring the raise reproduces that on every Ruby and every build, which a long computation cannot: Integer#** takes seven seconds without GMP and a fraction of a second with it. SIGKILL is not deferrable, so the supervisor still gets through.

Direct Known Subclasses

Impatient, Patient

Constant Summary collapse

SECONDS =
60

Constants inherited from Operation

Operation::READ_BYTES

Instance Method Summary collapse

Methods inherited from Operation

abstract_operation, abstract_operation?, before_fork, before_worker_boot, inherited, limits, operation, operation_name, #run_tool, unreadable

Instance Method Details

#perform(_inputs, _outputs) ⇒ Object



228
229
230
231
# File 'lib/hot_cell/test_operations.rb', line 228

def perform(_inputs, _outputs)
  Thread.handle_interrupt(Exception => :never) { sleep SECONDS }
  {}
end