Home / Docs / Diagnostics

U6007: The host stopped the run before it finished

Release v0.4.0

una run and native executables end a run with this error when the hard stop of a host stop cancels it (spec/26 §6, ADR 0116 rule 16). The output so far stays printed, the trace is written, and the exit code is 1.

Why Una rejects it

A host stop request is one of:

After the first request, every for ever ends at its next iteration start and runs its on stop, and the rest of the program runs on.

The hard stop comes at the end of the grace period, --stop-grace <seconds> (10 by default), or at a second request. It cancels the run at its next call or loop iteration, on stop blocks included.

A run that ends within the grace period ends normally, with exit code 0.

How to fix it

The repair at a glance

src/demo.unadiff
  module demo

  pub main() -> Unit
    diverges
  =
    let edit n = 0
    for ever
      n = n + 1
    on stop
-     for i in 0..<1000000000
+     for i in 0..<10
        n = n + 1
    unit

Failing example

Run it with una run --deadline 1 --stop-grace 1: the on stop block counts far past the grace period.

ita.unauna
ita demo
  version 0.1.0
  edition 0.4

run
  entry demo
ita.lockuna
lock 1

solver
  encoding "una-smt-1"
  name "z3"
  version "5.1.0"
  logic "QF_UFLIA"
  steps 5000000
  seed 0
src/demo.unauna
module demo

pub main() -> Unit
  diverges
=
  let edit n = 0
  for ever
    n = n + 1
  on stop
    for i in 0..<1000000000
      n = n + 1
  unit

Fixed example

Run it with una run --deadline 1 --stop-grace 1: the on stop block ends well within the grace period.

ita.unauna
ita demo
  version 0.1.0
  edition 0.4

run
  entry demo
ita.lockuna
lock 1

solver
  encoding "una-smt-1"
  name "z3"
  version "5.1.0"
  logic "QF_UFLIA"
  steps 5000000
  seed 0
src/demo.unauna
module demo

pub main() -> Unit
  diverges
=
  let edit n = 0
  for ever
    n = n + 1
  on stop
    for i in 0..<10
      n = n + 1
  unit