Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#14260 closed defect (fixed)

Build crashes with node.js version 0.6+

Reported by: tommyjr Owned by: Rawld Gill
Priority: blocker Milestone: 1.7.2
Component: BuildSystem Version: 1.7.0
Keywords: build node nodejs node.js backport1.7 Cc:
Blocked By: Blocking:

Description

When running the build with the newest version of node.js (version 6.1 - 11/11/2011), it throws an exception.

Command: node src/js/dtk/dojo/dojo.js load=build --help

After the normal help text, we get this:

1.7.0dev (23930)
running under node

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: process.stdout cannot be closed
    at WriteStream.<anonymous> (node.js:284:15)
    at Object.exit (build/node/process:13:19)
    at build/argv:520:11
    at /Users/tcjr/dev/misc/my-projects/taffey/src/js/dtk/dojo/dojo.js:980:43
    at /Users/tcjr/dev/misc/my-projects/taffey/src/js/dtk/dojo/dojo.js:1106:5
    at /Users/tcjr/dev/misc/my-projects/taffey/src/js/dtk/dojo/dojo.js:1097:12
    at /Users/tcjr/dev/misc/my-projects/taffey/src/js/dtk/dojo/dojo.js:1097:12
    at /Users/tcjr/dev/misc/my-projects/taffey/src/js/dtk/dojo/dojo.js:698:5
    at /Users/tcjr/dev/misc/my-projects/taffey/src/js/dtk/dojo/dojo.js:716:13
    at build/main:84:2

The error comes at the very end. It looks like everything completed successfully. If I comment out the offending line (process.stdout.end()), everything seems ok.

The node.js changelog (https://github.com/joyent/node/wiki/ChangeLog) suggests that this could be caused from new behavior in node.js.

Change History (19)

comment:1 Changed 8 years ago by Rawld Gill

Milestone: 1.8
Status: newassigned

comment:2 Changed 8 years ago by Colin Snover

Keywords: backport1.7 added
Priority: highblocker

This issue prevents dbp from working correctly because its build script halts execution if the build system returns a non-zero exit code (it seems like it should be safe to assume the build system only returns non-zero on legitimate errors). I’ll update the dbp build script to work around this, but it is an issue being hit by significant numbers of users so I am bumping this up to blocker for 1.8 and adding a keyword to make sure this fix is backported to 1.7.

comment:3 Changed 8 years ago by Colin Snover

Summary: Build crashes with node.js version 6.1Build crashes with node.js version 0.6+

comment:4 Changed 8 years ago by ben hockey

it looks like https://github.com/joyent/node/commit/ff0f0aeb401765646fefd9bbdc0f2a68d1ad342c will fix node to stop throwing the error and just emit it. to me this implies that we can/should safely remove process.stdout.end().

fwiw, i strongly agree with csnover to block 1.8 for this and backport the fix to 1.7

comment:5 Changed 8 years ago by ben hockey

fwiw, a colleague of mine applied the patch from node and the build still fails. removing the process.stdout.end() line seems to be the only solution.

comment:6 Changed 8 years ago by Rawld Gill

Resolution: fixed
Status: assignedclosed

In [27833]:

do not end std output, which breaks node 0.6; fixes #14260; !strict

comment:7 Changed 8 years ago by Rawld Gill

In [27834]:

remove noise; refs #14260; !strict

comment:8 Changed 8 years ago by Rawld Gill

In [27835]:

backport [27834]; fixes #14260; !strict

comment:9 Changed 8 years ago by bill

Milestone: 1.81.7.2

comment:10 Changed 8 years ago by Mathevet julien

Doesn't work on 1.7.2 release. I have nodejs v0.6.10.

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
ReferenceError: location is not defined
    at /mnt/share/src/dojo-1.7.2/dojo/dojo.js:237:27
    at Object.<anonymous> (/mnt/share/src/dojo-1.7.2/dojo/dojo.js:1787:2)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Array.0 (module.js:479:10)
    at EventEmitter._tickCallback (node.js:192:40)

Works on svn version

Last edited 8 years ago by Mathevet julien (previous) (diff)

comment:11 Changed 8 years ago by Mathevet julien

I just launch ./build.sh --help

comment:12 Changed 8 years ago by Colin Snover

0.6.11 worksforme.

comment:13 Changed 8 years ago by Mathevet julien

Ok I upgraded to nodejs 0.6.11 and works now

comment:14 in reply to:  10 Changed 8 years ago by Crio

Replying to moogle:

Doesn't work on 1.7.2 release. I have nodejs v0.6.10.

I've just installed Nodejs from Ubuntu repositories and got the same error.

node --version v0.6.11

comment:15 Changed 8 years ago by ben hockey

crio - perhaps #14916 is related to your issue.

comment:16 Changed 8 years ago by darth

I am encountering an issue in the similar area. The dojo build system does not exit out properly. It just hangs after finishing thus causing issues for automated builds.

This is not a persistant issue, but happens like 1 out of 3 or 4 times I build. http://i.imgur.com/ts7ph.png

Would seem that the "close" event in never triggered sometimes.

process.stdout.on('close', function(){
    process.exit(code);
});

as a result process doesn't exit.

While hacky, only way I can get it to consistently exit out is if I trigger the exit on the "drain" event.

process.stdout.on('drain', function(){
    process.exit(code);
});

This is on OSX 10.7/8, unsure about others. Using node.js version 0.6.11/12/13/14

The other solution is of course to use the java build instead for automated stuff.

Last edited 8 years ago by darth (previous) (diff)

comment:17 Changed 8 years ago by Maxim

I also have problems when running Dojo build system under Node.

With this simplest app.profile.js

var profile = {

    trees:[
        ["./lib/dtk/dojo", "./lib/dojo"],
        ["./lib/dtk/dijit", "./lib/dijit"]
    ]
};

when I run:

$ node lib/dtk/dojo/dojo.js load=build --profile app.profile.js --check-discovery

I got:

<...truncated...>
/path/to/my/proj/lib/dtk/dijit/nls/ko/loading.js-->/path/to/my/proj/release/lib/dijit/nls/ko/loading.js
/path/to/my/proj/lib/dtk/dijit/nls/zh/common.js-->/path/to/my/proj/release/lib/dijit/nls/zh/common.js
/path/to/my/proj/lib/dtk/dijit/nls/zh/loading.js-->/path/to/my/proj/release/lib/dijit/nls/zh/loading.js
{ [Error: write EPIPE] code: 'EPIPE', errno: 'EPIPE', syscall: 'write' }
Error: write EPIPE
    at errnoException (net.js:670:11)
    at Object.afterWrite [as oncomplete] (net.js:503:19)

Node version is v0.6.15.

comment:18 Changed 8 years ago by Philippe Soares

I've got the same problem using dojo-1.7.2 and nodejs v0.6.17 on RedHat? EL5.

$ node ../../dojo/dojo.js load=build --help

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
ReferenceError: location is not defined
    at /export_opt/src/web/js/dojo-1.7.2/dojo/dojo.js:237:27
    at Object.<anonymous> (/export_opt/src/web/js/dojo-1.7.2/dojo/dojo.js:1787:2)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Array.0 (module.js:479:10)
    at EventEmitter._tickCallback (node.js:192:40)

comment:19 Changed 8 years ago by Colin Snover

There’s no need to comment on this ticket unless you are using *trunk* and find that the build is not working.

Note: See TracTickets for help on using tickets.