Skip to content

Backtraces appear to be broken. #171

@haesbaert

Description

@haesbaert

I can't seem to get traces to work correctly, the trace is incomplete does not show the module that generated an exception, first I was generating a normal exception than I was told I needed to Lwt.wrap it, still have the same behaviour, this is the backtrace I get:

Fatal error: exception Failure("boom")
Raised at file "src/core/lwt.ml", line 788, characters 22-23
Called from file "src/unix/lwt_main.ml", line 34, characters 8-18
No line for the Boom.crash() call.
Called from file "exc.ml", line 13, characters 2-26 (This is the Lwt_main.run)

On my original case I don't even get the bottom line, my trace starts at lwt_main.ml line 34.

exc.ml:

open Lwt

let () = Printexc.record_backtrace true

let rec thread () =
  lwt () = Lwt_unix.sleep 1.0 in
  lwt () = wrap (fun () -> Boom.crash ()) in
  thread ()

let _ =
  Lwt_main.run (thread ())

boom.ml:

let crash () = failwith "boom"

here is the _log build:

### Starting build.
# Target: exc.ml.depends, tags: { bin_annot, debug, extension:ml, file:exc.ml, ocaml, ocamldep, package(lwt.syntax), package(lwt.unix), ppopt(-lwt-debug), quiet, strict_sequence, syntax(camlp4o), traverse }
ocamlfind ocamldep -package lwt.unix -package lwt.syntax -ppopt -lwt-debug -syntax camlp4o -modules exc.ml > exc.ml.depends
# Target: boom.ml.depends, tags: { bin_annot, debug, extension:ml, file:boom.ml, ocaml, ocamldep, package(lwt.syntax), package(lwt.unix), ppopt(-lwt-debug), quiet, strict_sequence, syntax(camlp4o), traverse }
ocamlfind ocamldep -package lwt.unix -package lwt.syntax -ppopt -lwt-debug -syntax camlp4o -modules boom.ml > boom.ml.depends # cached
# Target: boom.cmo, tags: { bin_annot, byte, compile, debug, extension:cmo, extension:ml, file:boom.cmo, file:boom.ml, implem, ocaml, package(lwt.syntax), package(lwt.unix), ppopt(-lwt-debug), quiet, strict_sequence, syntax(camlp4o), traverse }
ocamlfind ocamlc -c -g -bin-annot -strict-sequence -package lwt.unix -package lwt.syntax -ppopt -lwt-debug -syntax camlp4o -o boom.cmo boom.ml # cached
# Target: exc.cmo, tags: { bin_annot, byte, compile, debug, extension:cmo, extension:ml, file:exc.cmo, file:exc.ml, implem, ocaml, package(lwt.syntax), package(lwt.unix), ppopt(-lwt-debug), quiet, strict_sequence, syntax(camlp4o), traverse }
ocamlfind ocamlc -c -g -bin-annot -strict-sequence -package lwt.unix -package lwt.syntax -ppopt -lwt-debug -syntax camlp4o -o exc.cmo exc.ml
# Target: boom.cmx, tags: { bin_annot, compile, debug, extension:cmx, extension:ml, file:boom.cmx, file:boom.ml, implem, native, ocaml, package(lwt.syntax), package(lwt.unix), ppopt(-lwt-debug), quiet, strict_sequence, syntax(camlp4o), traverse }
ocamlfind ocamlopt -c -g -bin-annot -strict-sequence -package lwt.unix -package lwt.syntax -ppopt -lwt-debug -syntax camlp4o -o boom.cmx boom.ml # cached
# Target: exc.cmx, tags: { bin_annot, compile, debug, extension:cmx, extension:ml, file:exc.cmx, file:exc.ml, implem, native, ocaml, package(lwt.syntax), package(lwt.unix), ppopt(-lwt-debug), quiet, strict_sequence, syntax(camlp4o), traverse }
ocamlfind ocamlopt -c -g -bin-annot -strict-sequence -package lwt.unix -package lwt.syntax -ppopt -lwt-debug -syntax camlp4o -o exc.cmx exc.ml
# Target: exc.native, tags: { bin_annot, debug, dont_link_with, extension:native, file:exc.native, link, native, ocaml, package(lwt.syntax), package(lwt.unix), ppopt(-lwt-debug), program, quiet, strict_sequence, syntax(camlp4o), traverse }
ocamlfind ocamlopt -linkpkg -g -package lwt.unix -package lwt.syntax -syntax camlp4o boom.cmx exc.cmx -o exc.native
# Compilation successful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions