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

initializer using SearchLight that comes after searchlight.jl causes ConcurrencyViolationError #511

Closed
dms449 opened this issue Mar 31, 2022 · 5 comments
Assignees
Labels

Comments

@dms449
Copy link

dms449 commented Mar 31, 2022

Describe the bug
Having an initializer that uses SearchLight after initializers/searchlight.jl causes a ConcurrencyViolationError. Probably because some async task (possibly connecting to the Database?) is still running when the second import of SearchLight occurs.

Error stacktrace

Loading initializersERROR: ConcurrencyViolationError("lock must be held")
Stacktrace:
  [1] concurrency_violation()
    @ Base ./condition.jl:8
  [2] assert_havelock
    @ ./condition.jl:25 [inlined]
  [3] assert_havelock
    @ ./condition.jl:48 [inlined]
  [4] assert_havelock
    @ ./condition.jl:72 [inlined]
  [5] _wait2(c::Condition, waiter::Task)
    @ Base ./condition.jl:83
  [6] wait(c::Condition)
    @ Base ./condition.jl:120
  [7] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1077
  [8] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
  [9] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:997
 [10] top-level scope
    @ ~/workspace/projects/recultivate/RecultivateBackend/config/initializers/searchlight.jl:1
in expression starting at /home/dms449/workspace/projects/recultivate/RecultivateBackend/config/initializers/searchlight.jl:1

Ready!

julia>

To reproduce
1). create file config/initializers/temp.jl with only one line import SearchLight
2). try to load Genie app

Expected behavior
An initializer that uses SearchLight that comes after searchlight.jl will only be run AFTER SearchLight.jl is fully loaded

Additional context

  • happening on Julia 1.6.0 and 1.7.2
  • happening on latest Genie and Searchlight versions (4.17.0 and 2.2.0 respectively)
@dms449 dms449 changed the title initializer using SearchLight that comes after searchlight.jl causes concurrency initializer using SearchLight that comes after searchlight.jl causes ConcurrencyViolationError Mar 31, 2022
@dms449
Copy link
Author

dms449 commented Mar 31, 2022

A temporary hacky solution is to put a sleep(5) at the top of the initializer that depends on SearchLight. this gives it time to fully load before continueing.

@essenciary
Copy link
Member

Thanks - we'll investigate, defo need to get rid of the sleep.

@essenciary essenciary added the bug label May 27, 2022
@dms449
Copy link
Author

dms449 commented Jun 7, 2022

UPDATE:
I'm actually having the same problem with the plugins as well. if my plugin attempts to import almost anything that another plugin is also importing, I run into problems.

NOTE: If I remove the Threads@threads in the Genie.load_plugins everything works. Surely other people have run into this problem? It's not that odd to have 2 plugins or 2 initializers that import the same thing for the first time.

@dms449
Copy link
Author

dms449 commented Jun 7, 2022

Looks like this issue is being looked into for julia at large JuliaLang/julia#41602

Should be fixed in the 1.8 release

@essenciary
Copy link
Member

Closing as not actionable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants