Skip to content

Conversation

@maleadt
Copy link
Collaborator

@maleadt maleadt commented Oct 14, 2025

This makes it easier to differentiate between failures and crashes.

Should also make it easier to switch to Malt.jl which doesn't automatically serialize thrown exceptions (which would be bad in order to reconstruct testset failures).

@vchuravy
Copy link
Member

One thing we should check is if throwing a custom exception works.

Something like:

struct MyError <: Exception end
throw(MyError())

I assume (partially based on the Malt docs), that exceptions that are only defined on the worker process would lead to a serialization failure, which we should document as a caveat. Thankfully the 1.0 interface requires the module and thus encourages the user to load the package on the main process, so it should only occur for exceptions for package that are only loaded on the worker, or newly defined on the worker.

@maleadt
Copy link
Collaborator Author

maleadt commented Oct 14, 2025

I'm only storing TestSetExceptions though, all others are rethrown (and would get converted to Strings by Malt).

Comment on lines +196 to +203
function print_test_crashed(::Type{TestRecord}, wrkr, test, ctx::TestIOContext)
lock(ctx.lock)
try
printstyled(ctx.stderr, test, color = :red)
printstyled(
ctx.stderr,
lpad("($wrkr)", ctx.name_align - textwidth(test) + 1, " "), " |",
" "^ctx.elapsed_align, " crashed at $(now())\n", color = :red
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this still print the time? It's sometimes helpful to know how long it takes to crash

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crashes are highly unlikely, since we now catch every exception worker-side, so I rather wanted to keep the reporting logic as simple as possible. Besides, the testset right below will always report the time it took, even without --verbose:

               │          │ ──────────────── CPU ──────────────── │
Test  (Worker) │ Time (s) │ GC (s) │ GC % │ Alloc (MB) │ RSS (MB) │
basic      (2) |         crashed at 2025-10-15T08:32:27.239

Test Summary: | Error  Total  Time
  Overall     |     1      1  5.6s
    basic     |     1      1  3.8s
    FAILURE

This makes it easier to differentiate between failures and crashes.
@maleadt maleadt force-pushed the tb/record_exception branch from 8b14a04 to 87f190e Compare October 15, 2025 05:51
@maleadt
Copy link
Collaborator Author

maleadt commented Oct 15, 2025

One thing we should check is if throwing a custom exception works.

Something like:

struct MyError <: Exception end
throw(MyError())

Interestingly, this now works as-is, even when the main process doesn't have this definition. Try adding that to test/basic.jl, which the test runner never includes (only the worker), yet we still get to see:

Error in testset basic:
Error During Test at /Users/tim/Julia/pkg/ParallelTestRunner/src/ParallelTestRunner.jl:233
  Got exception outside of a @test
  LoadError: Main.var"##basic#232".MyError()

I'm not sure how that works? Is it actually serializing the struct definition too? This is probably something Malt doesn't support.

@maleadt maleadt merged commit ff8793f into main Oct 15, 2025
20 checks passed
@maleadt maleadt deleted the tb/record_exception branch October 15, 2025 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants