Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing package extentions gives ConcurrencyViolationError #308

Open
oameye opened this issue Oct 14, 2024 · 2 comments
Open

Testing package extentions gives ConcurrencyViolationError #308

oameye opened this issue Oct 14, 2024 · 2 comments

Comments

@oameye
Copy link

oameye commented Oct 14, 2024

When testing the extentions of my package with Aqua in the CI, I get a ConcurrencyViolationError:

using HarmonicBalance
using Aqua
using ModelingToolkit, OrdinaryDiffEqTsit5, SteadyStateDiffEq

TimeEvolution = Base.get_extension(HarmonicBalance, :TimeEvolution)
ModelingToolkitExt = Base.get_extension(HarmonicBalance, :ModelingToolkitExt)
SteadyStateDiffEqExt = Base.get_extension(HarmonicBalance, :SteadyStateDiffEqExt)

for mod in [TimeEvolution, ModelingToolkitExt, SteadyStateDiffEqExt]
    Aqua.test_ambiguities(mod)
    Aqua.test_all(
        mod;
        deps_compat=false,
        ambiguities=false,
        piracies=false,
        stale_deps=false,
        project_extras=false,
        persistent_tasks=false
    )
end
Error: Error during loading of extension SteadyStateDiffEqExt of HarmonicBalance, use `Base.retry_load_extensions()` to retry.
│   exception =1-element ExceptionStack:ConcurrencyViolationError("deadlock detected in loading SteadyStateDiffEqExt -> SteadyStateDiffEqExt")
│    Stacktrace:
│      [1] start_loading(modkey::Base.PkgId)
│        @ Base ./loading.jl:1637
│      [2] _require(pkg::Base.PkgId, env::Nothing)
│        @ Base ./loading.jl:1917
│      [3] __require_prelocked(uuidkey::Base.PkgId, env::Nothing)
│        @ Base ./loading.jl:1812
│      [4] #invoke_in_world#3
│        @ ./essentials.jl:926 [inlined]
│      [5] invoke_in_world
│        @ ./essentials.jl:923 [inlined]
│      [6] _require_prelocked
│        @ ./loading.jl:1803 [inlined]
│      [7] _require_prelocked
│        @ ./loading.jl:1802 [inlined]
│      [8] run_extension_callbacks(extid::Base.ExtensionId)
│        @ Base ./loading.jl:1295
│      [9] run_extension_callbacks(pkgid::Base.PkgId)
│        @ Base ./loading.jl:1330
│     [10] run_package_callbacks(modkey::Base.PkgId)
│        @ Base ./loading.jl:1164
│     [11] _tryrequire_from_serialized(modkey::Base.PkgId, path::String, ocachepath::String, sourcepath::String, depmods::Vector{Any})
│        @ Base ./loading.jl:1487
│     [12] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
│        @ Base ./loading.jl:1574
│     [13] _require(pkg::Base.PkgId, env::Nothing)
│        @ Base ./loading.jl:1938
│     [14] __require_prelocked(uuidkey::Base.PkgId, env::Nothing)
│        @ Base ./loading.jl:1812
│     [15] #invoke_in_world#3
│        @ ./essentials.jl:926 [inlined]
│     [16] invoke_in_world
│        @ ./essentials.jl:923 [inlined]
│     [17] _require_prelocked
│        @ ./loading.jl:1803 [inlined]
│     [18] _require_prelocked
│        @ ./loading.jl:1802 [inlined]
│     [19] macro expansion
│        @ ./lock.jl:267 [inlined]
│     [20] require(uuidkey::Base.PkgId)
│        @ Base ./loading.jl:1797
│     [21] iterate
│        @ ./generator.jl:47 [inlined]
│     [22] _collect(c::Vector{Base.PkgId}, itr::Base.Generator{Vector{Base.PkgId}, typeof(Base.require)}, ::Base.EltypeUnknown, isz::Base.HasShape{1})
│        @ Base ./array.jl:854
│     [23] collect_similar
│        @ ./array.jl:763 [inlined]
│     [24] map
│        @ ./abstractarray.jl:3285 [inlined]
│     [25] test_ambiguities_impl(packages::Vector{Base.PkgId}, options::@NamedTuple{recursive::Bool}, exspecs::Vector{Pair{Base.PkgId, String}}, skipdetails::Bool)
│        @ Aqua ~/.julia/packages/Aqua/Fxre9/src/ambiguities.jl:194
│     [26] top-level scope
│        @ none:8
│     [27] eval
│        @ ./boot.jl:385 [inlined]
│     [28] exec_options(opts::Base.JLOptions)
│        @ Base ./client.jl:291
│     [29] _start()
│        @ Base ./client.jl:552
└ @ Base loading.jl:1301
@lgoettgens
Copy link
Collaborator

Per its documentation, test_ambiguities expects packages (that is top-level modules). Packages extensions by themselves don't qualify as that, but unfortunately don't get caught by the test there.

Could you instead of e.g. test_ambiguities(ModelingToolkitExt) run test_ambiguities([HarmonicBalance, ModelingToolkit])? The latter should load the extension as well, as all of its triggers are already loaded.

(I'll leave this issue open until the check in test_ambiguities for top-level modules is fixed.)

@oameye
Copy link
Author

oameye commented Oct 14, 2024

Thanks for the swift response :)

@lgoettgens lgoettgens mentioned this issue Oct 15, 2024
28 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants