Giter Site home page Giter Site logo

Comments (5)

joshcooper avatar joshcooper commented on September 7, 2024 1

This was originally reported in https://puppet.atlassian.net/browse/PUP-11324. That issue tracker is now read-only, so please continue discussion here.

from puppet.

joshcooper avatar joshcooper commented on September 7, 2024

Thanks for letting us know @jstange We currently use the environment object to protect against concurrent access, such as

environment.lock.synchronize do
I think you'd want to do something similar for each of the Loaders instance methods that mutate state, like:

 def [](loader_name)
   environment.lock.synchronize do
      loader = @loaders_by_name[loader_name]
      if loader.nil?
        # Unable to find the module private loader. Try resolving the module
        loader = private_loader_for_module(loader_name[0..-9]) if loader_name.end_with?(' private')
        raise Puppet::ParseError, _("Unable to find loader named '%{loader_name}'") % { loader_name: loader_name } if loader.nil?
    end
    loader
end

Alternatively you could only lock when loader.nil?, but I think you need to relookup again inside the lock (double-checked lock)

def [](loader_name)
  loader = @loaders_by_name[loader_name]
  if loader.nil?
    environment.lock.synchronize do
     if loader.nil?
       ...

We don't have any immediate plans for working on this, but we welcome pull requests. I'll put the help wanted label on for now.

from puppet.

jstange avatar jstange commented on September 7, 2024

After some poking I might have some vague idea how threading works in here. Seems like it's JRuby-specific, and in the case I care about it's probably instances of Puppet::Util::Autoload that are competing to touch things in parallel.

[] probably isn't the only method that needs a thread seatbelt put on it, but I don't want to blindly add stuff and create potential deadlock conditions.

I'll spend some time with my stack traces and see if there's anywhere else that looks thread-dangerous and deadlock-safe, wrap those in environment.lock.synchronize, and submit a PR of it. Someone who knows what they're doing will have to review- my guesswork about threading in here may be wildly off base.

from puppet.

github-actions avatar github-actions commented on September 7, 2024

Migrated issue to PUP-12038

from puppet.

jstange avatar jstange commented on September 7, 2024

Finally got my corporate overlords to sign off on the CLA for the #9299. Our fix has been deployed locally for a while now and seems to solve the issue.

We've recently identified a similar, but distinct, threading issue, this one in Resource::Type. I'll open a separate issue for it once I've made sure my report isn't duplicating someone else's.

from puppet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.