Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-5615

Global lock in BaseMethod.NotResolved::resolve method can cause deadlock

    XMLWordPrintableJSON

Details

    Description

      See eclipse bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=515215

      org.apache.felix.scr.impl.inject.BaseMethod.NotResolved has a single instance which is held by the static field NotResolved.INSTANCE

      This means that the synchronized method NotResolved::resolve holds the global lock on this NotResolved.INSTANCE object. It is unclear why this complete method needs to be synchronized. But is is also unclear why it has to be a global lock also. Is this by design? or a consequence of some refactoring that made this method act on a global lock?

      This is causing issues because while calling BaseMethod::findMethod reflection is done which can then trigger additional class loads. These can then result in lazy activation to be triggered. There is a whole set of deadlock situations that could happen during lazy activation while this global lock is being held.

      I have not studied the code in detail, but it appears BaseMethod:findMethod is stateless and it is unclear why we need to hold a lock between calls to BaseMethod::findMethod and BaseMethod::setMethod (let alone a global lock).

      Attachments

        Activity

          People

            tjwatson Tom Watson
            tjwatson Tom Watson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: