Opened 8 years ago

Last modified 8 years ago

#15137 closed defect

race condition referencing indirect dependency when circular dependency exists — at Version 3

Reported by: bill Owned by: bill
Priority: low Milestone: 1.8
Component: Loader Version: 1.7.2
Keywords: Cc: Adam Peller
Blocked By: Blocking:

Description (last modified by bill)

This is the intermittent Maqetta failure that Adam mentioned in #13769, triggered by the circular dependency between dojo/dom-construct.js and dojo/dom-attr.js:

  1. On Maquetta startup, some module calls the css.js plugin as: davinci/css!davinci/review/resources/Comment.css
  1. css.js depends on dojo/dom-construct. Before the css.js plugin runs, dom-construct.js has been loaded, and it's factory has been run. In other words, the construct variable in css.js contains the methods defined in dom-construct.js.
  1. However, dojo/dom-construct has a dependency on dojo/dom-attr, and although dom-attr.js is already loaded, it's factory code hasn't been run yet, so require("dojo/dom-attr") === {}.
  1. Thus the css.js plugin runs, calls construct.create(), which tries to call attr.set() (or something like that), and fails, since the dom-attr.js factory hasn't been run yet.

The failure is complicated to recreate because you need to download and install maquetta, as per the instructions in https://github.com/maqetta/maqetta/wiki/Developer-Setup, and then comment out the workaround code added in https://github.com/maqetta/maqetta/issues/2047. I tried reducing it to a simpler case but no luck.

I thought you (Rawld) might be able to surmise the problem though given this description, without actually installing maquetta. Maquetta is using the sync loader, and this failure is happening against source (as opposed to a build).

Alternately, if this pattern isn't supposed to work, just let us know. Obviously the dom-construct.js factory shouldn't try to call functions in dom-attr.js, and vice-versa, but is it also true that other module factories shouldn't call functions in dom-attr.js and dom-construct.js? And by corollary that plugins shouldn't call methods in dom-attr.js and dom-construct.js? If so, the circular dependency just needs to be broken.

Change History (3)

comment:1 Changed 8 years ago by bill

Cc: Adam Peller added
Owner: changed from Rawld Gill to bill
Status: newassigned

comment:2 Changed 8 years ago by bill

Description: modified (diff)

comment:3 Changed 8 years ago by bill

Description: modified (diff)
Note: See TracTickets for help on using tickets.