Uploaded image for project: 'HiveMind'
  1. HiveMind
  2. HIVEMIND-155

Infinite Recusion Issue When Creating a Service

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.1
    • None
    • framework
    • None
    • Windows XP

    Description

      I am experiencing a problem by which HiveMind (version 1.1 and 1.1-beta-3) will enter into a infinite recursion when creating a service. This eventually exhausts all the available memory and makes the program unusable.

      I have a Service Class MyService implementing the interface IMyService.

      This class has a constructor public MyService (IMyService)

      {...}

      as well as other constructors.

      The service point of my service has no parameters or explicit injection via <set-service.

      When creating the service, it will eventually arrive at a the following test within the method instantiateCoreServiceInstance in BuildFactoryLogic.

      if (_parameter.getAutowireServices() && parameters.isEmpty())

      { return instantiateConstructorAutowiredInstance(serviceClass); }

      This test will be satisfied and the instantiateConstructorAutowiredInstance will then be called.

      In it will try and get all the constructors for the given class removing those not taking interfaces as parameters.

      List serviceConstructorCandidates = getOrderedServiceConstructors(serviceClass);

      One of this constructor will be the one with IMyService in it. If with bad luck it comes first in the iteration that follows, the code will try and call the constructor with parameters which are services attached to the interfaces of the parameters.

      Since the interface is the very interface of the service I am trying to build, it will enter the loop and never come back.

      An easy and effective fix might be to disregard constructors with the interface of the service it is currently trying to build thus avoiding the loop. I have tried that and it works fine.

      Attachments

        Activity

          People

            Unassigned Unassigned
            safarje Jean Safar
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: