Ticket #2532746 (closed defect)

Reporter


J. Shirley
Opened: 09/12/12
Last modified: 12/12/12
Status: closed
Type: defect
Resolution: fixed

Owner


Dav Glass
Target Release: 3.7.0
Priority: P3 (normal)
Summary: Loader changes for pr2 create infinite loop on server-side builds
Description:
I have a script that uses Loader under node.js to create a rollup file. The rollup file includes yui-base, which has it's own .add block:

http://_Sgithub.com/yui/yui3/blob/3.x/build/yui-base/yui-base-debug.js#L5718

The changes to filterRequires http://_Sgithub.com/yui/yui3/blob/master/src/loader/js/loader.js#L1357 are causing this to spin into oblivion when I use this generated rollup file.

This worked fine in pr1, and additionally a simple fix to not iterate into direct descendants got me up and running:


- if (m && m.use) {

+ if (m && m.use && ( m.name !== mod.name ) ) {

This is a pretty critical issue for me, but I'm hesitant to put it at anything other than S2.

I'm on IRC and on twitter if you need any further details or want an example rollup file.

Type: defect Observed in Version: 3.7.0pr2
Component: Loader Severity: S2 (high)
Assigned To: Dav Glass Target Release: 3.7.0
Location: Library Code Priority: P3 (normal)
Tags: Relates To:
Browsers: N/A
URL:
Test Information:

Change History

J. Shirley

YUI Contributor

Posted: 09/12/12

Looking at this further I think my initial kneejerk reading was wrong. the add is for yui, not yui-base. I should learn to read.

I can confirm that using that patch is fixing my immediate issue, but it won't fix a higher level circular dependency issue.

Dav Glass

Posted: 09/12/12
  • priority changed to P3 (normal)
  • status changed from new to infoneeded

Two issues here:

Can you revert your patch and change this line in yui-base:


YUI.add('yui', function (Y, NAME) {}, '@VERSION@', {"use": ["yui-base", "get", "features", "intl-base", "yui-log", "yui-later"]});

to


YUI.add('yui', function (Y, NAME) {}, '@VERSION@', {"use": ["get", "features", "intl-base", "yui-log", "yui-later"]});

And see if that fixes the issue as well?

The second issue is the recursion that's a side effect of this build stamp.

  • Comment Updated, I had them backwards**

Dav Glass

Posted: 09/12/12
  • location changed to Library Code
  • milestone changed to 3.7.0
  • status changed from infoneeded to assigned

Dav Glass

Posted: 09/12/12
  • status changed from assigned to accepted

Dav Glass

Posted: 09/12/12
  • status changed from accepted to infoneeded

J. Shirley

YUI Contributor

Posted: 09/12/12

I'm looking and working from at what is in the yui@3.7.0pr2 installed from npm (this is a result of using Loader under Node, generating a list of YUI dependencies and then creating a rollup).

In node_modules/yui/yui-base/yui-base-debug.js, it already has (with yui-base in there):

YUI.add('yui', function (Y, NAME) {}, '3.7.0pr2', {"use": ["yui-base", "get", "features", "intl-base", "yui-log", "yui-later"]});

What is happening now is that somewhere, yui-base has yui-base in it's use list when generating these files from node (I'm still trying to figure out exactly where).

To give you a better idea of what my script is doing is to use Y.Loader under Node to generate a list of YUI dependencies for an application, this allows me to create a single rollup file for distribution under phonegap.

If it's helpful, I can provide you with the full list of files in the build list that are being concatenated together for distribution.

I'm working on a small repro case right now.

Dav Glass

Posted: 09/12/12

Just open the file under 'node_modules/yui/yui-base/yui-base-debug.js' and remove the "yui-base" from that line. Then test to make sure you are good.

I've tested it locally and it works for me.

The issue is the build.json file was declaring "yui-base" in it's config:
https://github.com/yui/yui3/blob/3.x/src/yui/build.json#L161-182

Just wanting you to confirm that removing that fixes your issue. The loop is a separate issue that I patched already.

J. Shirley

YUI Contributor

Posted: 09/12/12
  • status changed from infoneeded to assigned

Oh - sorry, I was on my way out the door and was trying to get a repro case hastily and read your directions wrong.

In my generated file, I edited the YUI.add('yui', ...) line and remove yui-base, but it still ends up in a situation with yui-base is depending on yui-base.

Is there something there that I can inspect that could be more help in tracing it?

I can also provide you with my generated build file if you want (don't want to attach it here, but can send it through private channels)

J. Shirley

YUI Contributor

Posted: 09/13/12

Ok, what was happening in my scenario was yui-nodejs/yui-nodejs*.js files also had that use line. I had to excise it from those files as well and now normalcy is returned.

So I can confirm that removing yui-base from the .add('yui', ...) lines does work, provided you remove it from all the places. There's a meme in here somewhere...

Dav Glass

Posted: 09/13/12
  • resolution changed to fixed
  • status changed from assigned to checkedin

Fixes #2532746 - kill the loop
View Commit: d12cefa97d95f16afe08c7f990cd1634b4ef47c2

Jenny Donnelly

YUI Developer

Posted: 12/12/12
  • status changed from checkedin to closed