Uploaded image for project: 'Fluid Infusion'
  1. Fluid Infusion
  2. FLUID-5904

Component which throws exception triggering self-destruction during creation will fail during cleanup

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0
    • Component/s: IoC System
    • Labels:
      None

      Description

      A component which throws an exception before its events are constructed - for example, from an expander which is used to initialise an option - will be left in a condition which cannot properly go through the cleanup lifecycle of "doDestroy" since the line that.events.onDestroy.fire() in fluid.doDestroy (currently Fluid.js line 2597) references a nonexistent event.

      This was discovered whilst testing Kettle's "static middleware" error handling, which appears like this:

      fluid.defaults("kettle.middleware.static", {
          gradeNames: ["kettle.plainMiddleware"],
      ...
          // Remember that we write this kind of rubbish because of the crummy pre-FLUID-4982 ginger world
          middleware: "@expand:kettle.middleware.static.createMiddleware({that}.options.root, {that}.options.terms, {that}.options.middlewareOptions)"
      });
      
      kettle.middleware["static"].createMiddleware = function (root, terms, middlewareOptions) {
          if (!root) {
              fluid.fail("Static middleware must have a root path configured to serve options - got ", root);
          }
      ...
      };
      

      This is a class of error we will have to be particularly aggressive at tackling in the post FLUID-4982 world where component construction will have to be fully transactional and Nexus-ready.

        Attachments

          Activity

            People

            Assignee:
            antranig Antranig Basman
            Reporter:
            antranig Antranig Basman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: