Skip to content

Default Selectors are not unique #717

Closed
@mhauru

Description

@mhauru
using DynamicPPL

function make_selectors()
    s1 = DynamicPPL.Selector()
    s2 = DynamicPPL.Selector()
    return s1, s2
end

for i in 1:10
    s1, s2 = make_selectors()
    println("$(s1.gid == s2.gid)")
end

Indeterministic example output:

true
true
true
false
false
true
true
false
true
true

This is causing indeterministic test failures over at TuringLang/Turing.jl#2328

The cause is this:

function Selector(tag::Symbol=:default, rerun=tag != :default)
    return Selector(time_ns(), tag, rerun)
end

Sometimes to calls execute within a nanosecond, sometimes they don't.

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