Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Node.js 8 to Travis CI #2086

Merged
merged 1 commit into from
Jun 12, 2017
Merged

Conversation

alexlamsl
Copy link
Collaborator

closes #2081

@@ -8,7 +8,7 @@ function run(command, args, done) {
process.stdout.write("\0");
}, 5 * 60 * 1000);
spawn(command, args, {
stdio: "ignore"
stdio: [ "ignore", 1, 2 ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I correct in assuming you want to ignore both stdout and stderr instead of just stdout?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I'm ignoring stdin, and pipe both stdout and stderr out.

Used to be I just ignore them all to avoid getting flooded on the console, but now that I'm comfortable enough navigating around them, I think it makes sense to have Travis CI record these details down, so we can have extra data points for diagnosis and even say performance tracking via test/benchmark.js timings.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this works out I will also be removing that process.stdout.write("\0"); at 5min intervals, as that was a workaround for Travis CI (& none of the individual scripts from test/benchmark.js or test/jetstream.js should take more than 10 minutes to be uglified).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, these extra lines are the result of the aforementioned change:

https://travis-ci.org/mishoo/UglifyJS2/jobs/242117329#L1299-L1402

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I guess we'll know in a few minutes why it's failing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just saw that - job restarted 👍

@alexlamsl
Copy link
Collaborator Author

So it looks to me that with Node.js 8, test/jetstream.js somehow fails to terminate its process:

https://travis-ci.org/mishoo/UglifyJS2/jobs/242117333#L2580

@kzc
Copy link
Contributor

kzc commented Jun 12, 2017

Spawned processes are inherently unreliable. Wouldn't surprise me if a bug cropped up in node 8 as historically node has had problems with flushing streams upon process.exit() and uncaught exceptions.

If test/jetstream.js sees the output "JetStream completed successfully." can termination be forced?

@alexlamsl
Copy link
Collaborator Author

If test/jetstream.js sees the output "JetStream completed successfully." can termination be forced?

I can just force process.exit() at the end if that turns out to be necessary, so no trouble there. I just have this bad habit of letting Nature takes its course 😉

@kzc
Copy link
Contributor

kzc commented Jun 12, 2017

I can just force process.exit() at the end if that turns out to be necessary, so no trouble there. I just have this bad habit of letting Nature takes its course

God knows what node is doing at that point. Probably deadlocked itself or waiting for something to close that will never happen.

@alexlamsl
Copy link
Collaborator Author

If there is indeed something left in the event dispatch loop that prevents node from terminating automatically, it's either Linux or Travis specific, since I've tried on Windows:

$ git clean -xdf
$ npm install --no-optional --no-save
$ set UGLIFYJS_TEST_ALL=1
$ npm test

and I have yet to observe any failures locally.

@@ -64,6 +64,7 @@ if (typeof phantom == "undefined") {
server.close();
if (code) throw new Error("JetStream failed!");
console.log("JetStream completed successfully.");
process.exit();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use process.exit(0); to convey it's a success.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in df1c48e

@alexlamsl
Copy link
Collaborator Author

With the addition of process.exit(0), Node.js 8 test now passes.
https://travis-ci.org/mishoo/UglifyJS2/jobs/242146287

@kzc
Copy link
Contributor

kzc commented Jun 12, 2017

node 0.12 timed out: https://travis-ci.org/mishoo/UglifyJS2/jobs/242153107

Here's an idea - can you do a SHA1 or MD5 checksum on each JS file with the CLI options prepended to it and cache the uglify result in memory the first time it is run? Since the jetstream tests are run 3 times each it should cut the runtime by 66%.

@alexlamsl
Copy link
Collaborator Author

Since the jetstream tests are run 3 times each it should cut the runtime by 66%.

Heh - we are only running those tests once 😉

https://github.com/mishoo/UglifyJS2/blob/b0eab71470fa887752bcf5442fbb26da3f724ef1/test/jetstream.js#L96

@kzc
Copy link
Contributor

kzc commented Jun 12, 2017

Curses! Foiled again!

@alexlamsl
Copy link
Collaborator Author

What it does show is the console I/O seems to play a significant part in job performance. Now this could be Travis having transient slowdown, so we'll need to run more of them in the near future to see if the pattern holds.

- explicitly terminate `test/jetstream.js` upon completion
- log verbose output from `test/benchmark.js` & `test/jetstream.js`
- remove obsolete workaround for Travis CI
@kzc
Copy link
Contributor

kzc commented Jun 12, 2017

Pure speculation: when there's an I/O event the job gets demoted in priority. What else could explain how these tests take 5 minutes locally and 50 minutes on travis CI?

How many active uglify sub-processes are active at any point in time? You know how most browsers have 6 connections to the same web server to parallelize downloads - can we limit that concurrency on the PhantomJS fake browser client to just 2 max?

@alexlamsl
Copy link
Collaborator Author

alexlamsl commented Jun 12, 2017

can we limit that concurrency on the PhantomJS fake browser client to just 2 max?

JetStream benchmark itself seems to only download the relevant script files, one after another, right before executing them. So regardless of the parallelism offered by phantomjs, I have yet to observe multiple instance of bin/uglifyjs being active simultaneously locally.

As for the I/O, I think they are storing that in some form of database backend, which seems to frequently be the cause of slow-downs / outages judging from their status page.

Edit: for instance, https://www.traviscistatus.com/incidents/93wfcv0ksqrz

@kzc
Copy link
Contributor

kzc commented Jun 12, 2017

Can we store the Jetstream JS and html files in the uglify repo to not incur as much I/O? I think it's a job priority problem.

@alexlamsl
Copy link
Collaborator Author

Can we store the Jetstream JS and html files in the uglify repo to not incur as much I/O? I think it's a job priority problem.

Oh you mean the network I/O over the Internet? I was comparing stdout volume as there seems to be a correlation between more text printed and longer total runtime.

Storing the full copy of JetStream locally seems a little excessive. Technically, we can make the CI job go fetch (via wget?) those contents in advance before we run the tests, so at least that way we don't get interrupted network I/O activities. I'm no expert in using *nix for site ripping though.

@alexlamsl alexlamsl changed the title [WIP] add Node.js 8 to Travis CI add Node.js 8 to Travis CI Jun 12, 2017
@alexlamsl alexlamsl merged commit 3dc9e14 into mishoo:master Jun 12, 2017
@alexlamsl alexlamsl deleted the travis-node-8 branch June 12, 2017 22:21
@kzc
Copy link
Contributor

kzc commented Jun 12, 2017

Oh you mean the network I/O over the Internet?

Yes.

I was comparing stdout volume as there seems to be a correlation between more text printed and longer total runtime.

Anything's possible. Just throwing out ideas.

Technically, we can make the CI job go fetch (via wget?) those contents in advance before we run the tests, so at least that way we don't get interrupted network I/O activities.

That could work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants