Skip to content

_FILE_AST is an unsynchronised process-global mutated inside Test.record, so a threaded testset races only when the report is on #125

Description

@sotashimozono

src/testset.jl:310 declares _FILE_AST as a plain Dict, written via get! from _file_ast (:313), which is called inside Test.record (ext/PinaxTestExt.jl:141).

The module header claims task-locality. That covers the container -- the captured tree -- but not this cache, which is global and unlocked.

A suite using Threads.@spawned testsets is a supported Test pattern. Concurrent get! on an unlocked Dict can corrupt it or crash.

Why this one is worse than an ordinary race

It happens only when the report is enabled. The machinery whose selling point is that it observes the suite without affecting it becomes the thing that breaks the suite -- and only in the configuration a user turns on to get a report.

Fix

Guard _FILE_AST with a lock, or make it task-local like the container it lives beside.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtest-reportThe Test -> Pinax bridge (experimental)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions