Skip to content

uncaught exception with corrupted cache or _build #14735

@raphael-proust

Description

@raphael-proust

Expected Behavior

When a build is interrupted, the _build/ dir or the cache can become corrupted and subsequent builds get a very wild error message for an uncaught exception.

  • no corruption, or
  • informative error message and a tool to recover manually, or
  • automatic recovery

Actual Behavior

I get the following error message (I removed actual file names, replaced with […]), I left the null-byte string as is from the error message.

Description:
  ("Invalid Module_name.t",
   { s = "\000\000\000\000\000\000\000\000\000\000\000\000\000\000" })
Raised at Stdune__Code_error.raise in file "stdune__Code_error.ml", line 11,
  characters 30-62
Called from Dune_lang__Module_name.Unique.of_string in file
  "dune_lang__Module_name.ml", line 88, characters 55-68
Called from Dune_rules__Ocamldep.parse_compilation_units.(fun) in file
  "dune_rules__Ocamldep.ml", line 82, characters 19-49
Called from Stdune__List.rev_filter_map.loop in file "stdune__List.ml", line
  22, characters 13-16
Called from Stdune__List.filter_map in file "stdune__List.ml" (inlined), line
  29, characters 26-47
Called from Dune_rules__Ocamldep.parse_compilation_units in file
  "dune_rules__Ocamldep.ml", lines 81-84, characters 2-54
Called from Dune_engine__Action_builder.T.M.map.(fun) in file
  "dune_engine__Action_builder.ml", line 45, characters 12-15
Called from Fiber__Core.O.(>>|).(fun) in file "fiber__Core.ml", line 258,
  characters 36-41
Called from Fiber__Scheduler.exec in file "fiber__Scheduler.ml", line 77,
  characters 8-11
Re-raised at Stdune__Exn.raise_with_backtrace in file "stdune__Exn.ml"
  (inlined), line 39, characters 27-56
Called from Stdune__Exn_with_backtrace.reraise in file
  "stdune__Exn_with_backtrace.ml", line 21, characters 33-71
Called from Fiber__Scheduler.exec in file "fiber__Scheduler.ml", line 77,
  characters 8-11
Re-raised at Stdune__Exn.raise_with_backtrace in file "stdune__Exn.ml"
  (inlined), line 39, characters 27-56
Called from Stdune__Exn_with_backtrace.reraise in file
  "stdune__Exn_with_backtrace.ml", line 21, characters 33-71
Called from Fiber__Scheduler.exec in file "fiber__Scheduler.ml", line 77,
  characters 8-11
Re-raised at Stdune__Exn.raise_with_backtrace in file "stdune__Exn.ml"
  (inlined), line 39, characters 27-56
Called from Stdune__Exn_with_backtrace.reraise in file
  "stdune__Exn_with_backtrace.ml", line 21, characters 33-71
Called from Fiber__Scheduler.exec in file "fiber__Scheduler.ml", line 77,
  characters 8-11
Re-raised at Stdune__Exn.raise_with_backtrace in file "stdune__Exn.ml"
  (inlined), line 39, characters 27-56
Called from Stdune__Exn_with_backtrace.reraise in file
  "stdune__Exn_with_backtrace.ml", line 21, characters 33-71
Called from Fiber__Scheduler.exec in file "fiber__Scheduler.ml", line 77,
  characters 8-11
Re-raised at Stdune__Exn.raise_with_backtrace in file "stdune__Exn.ml"
  (inlined), line 39, characters 27-56
Called from Stdune__Exn_with_backtrace.reraise in file
  "stdune__Exn_with_backtrace.ml", line 21, characters 33-71
Called from Fiber__Scheduler.exec in file "fiber__Scheduler.ml", line 77,
  characters 8-11
-> required by
   ("_build/default/[…]",
    ())
-> required by ("Rule.make", ())
-> required by
   ("execute-rule",
    { id = 259307
    ; info =
        From_dune_file
          { pos_fname =
              "[…]/dune"
          ; start = { pos_lnum = […]; pos_bol = […]; pos_cnum = […] }
          ; stop = { pos_lnum = […]; pos_bol = […]; pos_cnum = […] }
          }
    })
-> required by ("<unnamed>", ())
-> required by
   ("build-file",
    In_build_dir
      "default/[…]")
-> required by ("<unnamed>", ())
-> required by
   ("build-alias",
    { dir = In_build_dir "default/[…]"; name = "[…]" })
-> required by ("toplevel", ())
I must not crash.  Uncertainty is the mind-killer. Exceptions are the
little-death that brings total obliteration.  I will fully express my cases.
Execution will pass over me and through me.  And when it has gone past, I
will unwind the stack along its path.  Where the cases are handled there will
be nothing.  Only I will remain.

Note that when these failures happen, they generally happen multiple times. I'm guessing that parallel jobs in the build experience them and that all the errors are printed (before the build is interrupted by the failures).

Reproduction

I'm trying to reproduce the corruption.

Specifications

  • Version of dune (output of dune --version): 3.21.1
  • Version of ocaml (output of ocamlc --version): 5.4.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions