Skip to content

Commit 9f02555

Browse files
committed
fix(multicore): Domain.join: do not lose backtrace
When an exception from a joined domain is raised, the backtrace is lost. Instead, the backtrace the user gets indicates that it originated from Domain.join, as opposed to where the error occurred inside the domain. We (Semgrep) have started noticing this in CI runs, which makes pinning the root cause difficult. Note that this necessitated reordering `Domain` in stdlib/StdlibModules.
1 parent 3d8d8cb commit 9f02555

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

stdlib/StdlibModules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ STDLIB_MODULE_BASENAMES = \
7070
mutex \
7171
condition \
7272
semaphore \
73-
domain \
7473
camlinternalFormat \
7574
printf \
7675
arg \
7776
printexc \
77+
domain \
7878
fun \
7979
gc \
8080
in_channel \

stdlib/domain.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,6 @@ let join { term_sync ; _ } =
296296
in
297297
match Mutex.protect term_sync.mut loop with
298298
| Ok x -> x
299-
| Error ex -> raise ex
299+
| Error ex -> Printexc.raise_with_backtrace ex (Printexc.get_raw_backtrace ())
300300

301301
let recommended_domain_count = Raw.get_recommended_domain_count

0 commit comments

Comments
 (0)