The Nodesource Blog

#shoptalk Subscribe

Node.js v5.0.0 Release Brief

As planned and discussed in Rod Vagg's post Essential Steps: Long Term Support for Node.js, Node v4 went into Long Term Support mode three weeks ago.

"The point of establishing an LTS plan for Node is to build on top of an existing stable release cycle by delivering new versions on a predictable schedule that have a clearly defined extended support lifecycle."

However, with the pace of development in Node.js core these days, a release line is needed to get new stable features into the community’s hands without being held up for months at a time. The v5 release will be that line where stable features will be added for the next 6 months.

This major version bump allows us to clean up some parts the Node API to make it better for the future. Some of these changes are breaking changes, which you can find more information about on the Node.js wiki. We have taken great care to ensure these changes are conservative and minimally breaking, and don’t expect them to affect most people’s applications.

Code Change Stats

Of a total of 123 commits:

  • 23 were documentation-only commits.
  • 29 only modify tests and 4 only affect internal-only tooling.
  • 12 of the commits consist of 2 dependency updates + floating patches:

18 commits were tagged as semver-major, justifying the jump to v5.0.0:

  • [5f6579d366] - buffer: remove raw & raws encoding (Sakthipriyan Vairamani) #2859
  • [870108aaa8] - console: sub-millisecond accuracy for console.time (Michaël Zasso) #3166
  • [d8011d1683] - deps: upgrade V8 to 4.6.85.23 (Michaël Zasso) #3351
  • [680dda8023] - dns: remove nonexistant exports.ADNAME (Roman Reiss) #3051
  • [2bb147535e] - fs: don't throw in read if buffer too big (Evan Lucas) #3503
  • [7added3b39] - fs: pass err to callback if buffer is too big (Evan Lucas) #3485
  • [e655a437b3] - http: do not allow multiple instances of certain response headers (James M Snell) #3090
  • [0094a8dad7] - http: add callback is function check (James M Snell) #3090
  • [6192c9892f] - http: add checkIsHttpToken check for header fields (James M Snell) #2526
  • [c9786bb680] - http{s}: don't connect to localhost on invalid URL (Sakthipriyan Vairamani) #2967
  • [47befffc53] - lib,test: deprecate _linklist (Rich Trott) #3078
  • [6ad458b752] - module: remove unnecessary property and method (Sakthipriyan Vairamani) #2922
  • [ce391ed849] - repl: event ordering: delay 'close' until 'flushHistory' (Jeremiah Senkpiel) #3435
  • [bf7c3dabb4] - src: bump NODE_MODULE_VERSION To 47 (Rod Vagg) #3400
  • [f72e178a78] - tls: add minDHSize option to tls.connect() (Shigeki Ohtsu) #1831
  • [80573153b8] - util: make inherits work with classes (Michaël Zasso) #3455
  • [412252ca04] - util: Remove p, has been deprecated for years (Wyatt Preul) #3432
  • [80169b1f0a] - zlib: decompression throw on truncated input (Yuval Brik) #2595

In addition, 6 commits were tagged as semver-minor:

  • [5e0759f6fd] - fs: add file descriptor support to *File() funcs (Johannes Wüller) #3163
  • [f236b3a904] - lib,doc: return boolean from child.send() (Rich Trott) #3516
  • [2296a4fc0f] - tls: add options argument to createSecurePair (Коренберг Марк) #2441
  • [6d92ebac11] - tls: add TLSSocket.getEphemeralKeyInfo() (Shigeki Ohtsu) #1831
  • [62ad1d0113] - tls, crypto: add ALPN Support (Shigeki Ohtsu) #2564
  • [5029f41b2f] - tls,crypto: move NPN protocol data to hidden value (Shigeki Ohtsu) #2564

The remaining significant commits are as follows:

  • [6a04cc0a43] - buffer: fix value check for writeUInt{B,L}E (Trevor Norris) #3500
  • [1a41feb559] - buffer: don't CHECK on zero-sized realloc (Ben Noordhuis) #3499
  • [70fca2a81e] - build: Updates for AIX npm support - part 1 (Michael Dawson) #3114
  • [b36b4f385a] - build: rectify --link-module help text (P.S.V.R) #3379
  • [a89eeca590] - console: rename argument of time and timeEnd (Michaël Zasso) #3166
  • [a334ddc467] - Revert "deps: backport 03ef3cd from V8 upstream" (Ali Ijaz Sheikh) #3237
  • [4c9abbd1bb] - fs: reduced duplicate code in fs.write() (ronkorving) #2947
  • [d1a2e5357e] - gitignore: don't ignore debug source directory in V8 (Michaël Zasso) #3351
  • [ab03635fb1] - http: fix stalled pipeline bug (Fedor Indutny) #3342
  • [1929d5be73] - lib: fix cluster handle leak (Rich Trott) #3510
  • [97d081709e] - lib: avoid REPL exit on completion error (Rich Trott) #3358
  • [6e887cc630] - lib,test: update let to const where applicable (Sakthipriyan Vairamani) #3152
  • [d5ce53458e] - lttng: update flags for gc tracing (Glen Keane) #3388
  • [ae196175f4] - node: improve GetActiveRequests performance (Trevor Norris) #3375
  • [bd4311bc9c] - repl: handle comments properly (Sakthipriyan Vairamani) #3515
  • [4c80c02ac7] - repl: limit persistent history correctly on load (Jeremiah Senkpiel) #2356
  • [134a60c785] - src: fix race condition in debug signal on exit (Ben Noordhuis) #3528
  • [2d3560767e] - src: fix exception message encoding on Windows (Brian White) #3288
  • [ff877e93e1] - src: fix stuck debugger process (Liang-Chi Hsieh) #2778
  • [8854183fe5] - stream: avoid unnecessary concat of a single buffer. (Calvin Metcalf) #3300
  • [85b74de9de] - stream: fix signature of _write() in a comment (Fábio Santos) #3248
  • [522e3d3cd3] - timers: reuse timer in setTimeout().unref() (Fedor Indutny) #3407
  • [b64ce5960f] - tls: remove util and calls to util.format (Myles Borins) #3456
  • [c64af7d99e] - tls: TLSSocket options default isServer false (Yuval Brik) #2614
  • [0140e1b5e3] - tls: output warning of setDHParam to console.trace (Shigeki Ohtsu) #1831
  • [6936468de2] - vm: remove Watchdog dependency on Environment (Ido Ben-Yair) #3274

Notable Changes

  • buffer: (Breaking) Removed both 'raw' and 'raws' encoding types from Buffer, these have been deprecated for a long time (Sakthipriyan Vairamani) #2859.
  • console: (Breaking) Values reported by console.time() now have 3 decimals of accuracy added (Michaël Zasso) #3166.
  • fs:
    • fs.readFile*(), fs.writeFile*(), and fs.appendFile*() now also accept a file descriptor as their first argument (Johannes Wüller) #3163.
    • (Breaking) In fs.readFile(), if an encoding is specified and the internal toString() fails the error is no longer thrown but is passed to the callback (Evan Lucas) #3485.
    • (Breaking) In fs.read() (using the fs.read(fd, length, position, encoding, callback) form), if the internal toString() fails the error is no longer thrown but is passed to the callback (Evan Lucas) #3503.
  • http:
    • Fixed a bug where pipelined http requests would stall (Fedor Indutny) #3342.
    • (Breaking) When parsing HTTP, don't add duplicates of the following headers: Retry-After, ETag, Last-Modified, Server, Age, Expires. This is in addition to the following headers which already block duplicates: Content-Type, Content-Length, User-Agent, Referer, Host, Authorization, Proxy-Authorization, If-Modified-Since, If-Unmodified-Since, From, Location, Max-Forwards (James M Snell) #3090.
    • (Breaking) The callback argument to OutgoingMessage#setTimeout() must be a function or a TypeError is thrown (James M Snell) #3090.
    • (Breaking) HTTP methods and header names must now conform to the RFC 2616 "token" rule, a list of allowed characters that excludes control characters and a number of separator characters. Specifically, methods and header names must now match /^[a-zA-Z0-9_!#$%&'*+.^`|~-]+$/ or a TypeError will be thrown (James M Snell) #2526.
  • node:
    • (Breaking) Deprecated the _linklist module (Rich Trott) #3078.
    • (Breaking) Removed require.paths and require.registerExtension(), both had been previously set to throw Error when accessed (Sakthipriyan Vairamani) #2922.
  • npm: Upgraded to version 3.3.6 from 2.14.7, see https://github.com/npm/npm/releases/tag/v3.3.6 for more details. This is a major version bump for npm and it has seen a significant amount of change. Please see the original npm v3.0.0 release notes for a list of major changes (Rebecca Turner) #3310.
  • src: (Breaking) Bumped NODE_MODULE_VERSION to 47 from 46, this is necessary due to the V8 upgrade. Native add-ons will need to be recompiled (Rod Vagg) #3400.
  • timers: Attempt to reuse the timer handle for setTimeout().unref(). This fixes a long-standing known issue where unrefed timers would perviously hold beforeExit open (Fedor Indutny) #3407.
  • tls:
    • Added ALPN Support (Shigeki Ohtsu) #2564.
    • TLS options can now be passed in an object to createSecurePair() (Коренберг Марк) #2441.
    • (Breaking) The default minimum DH key size for tls.connect() is now 1024 bits and a warning is shown when DH key size is less than 2048 bits. This a security consideration to prevent "logjam" attacks. A new minDHSize TLS option can be used to override the default. (Shigeki Ohtsu) #1831.
  • util:
    • (Breaking) util.p() was deprecated for years, and has now been removed (Wyatt Preul) #3432.
    • (Breaking) util.inherits() can now work with ES6 classes. This is considered a breaking change because of potential subtle side-effects caused by a change from directly reassigning the prototype of the constructor using ctor.prototype = Object.create(superCtor.prototype, { constructor: { ... } }) to using Object.setPrototypeOf(ctor.prototype, superCtor.prototype) (Michaël Zasso) #3455.
  • v8: (Breaking) Upgraded to 4.6.85.25 from 4.5.103.35 (Ali Ijaz Sheikh) #3351.
  • zlib: Decompression now throws on truncated input (e.g. unexpected end of file) (Yuval Brik) #2595.

Git Diffstats

(Showing the delta between v4.2.1 and v5.0.0, ignoring deps/npm.)

Without deps, docs, benchmarks, or tests:

 .eslintrc                     |   5 +
 .gitignore                    |   1 +
 configure                     |   7 +-
 lib/_http_client.js           |   6 ++
 lib/_http_common.js           |  14 +++
 lib/_http_incoming.js         |   6 ++
 lib/_http_outgoing.js         |  84 +++++++++-------
 lib/_http_server.js           |  39 ++++++--
 lib/_linklist.js              |  57 +----------
 lib/_stream_readable.js       |   2 +
 lib/_stream_writable.js       |   2 +-
 lib/_tls_common.js            |   6 +-
 lib/_tls_legacy.js            |  21 +++-
 lib/_tls_wrap.js              |  50 +++++++++-
 lib/buffer.js                 |  16 ++--
 lib/cluster.js                |   7 +-
 lib/console.js                |  15 +--
 lib/dns.js                    |   1 -
 lib/fs.js                     | 134 ++++++++++++++++++++------
 lib/https.js                  |  10 ++
 lib/internal/child_process.js |   6 +-
 lib/internal/linkedlist.js    |  57 +++++++++++
 lib/internal/repl.js          |   4 +-
 lib/module.js                 |  10 --    
 lib/repl.js                   | 205 ++++++++++++++++++++++-----------------
 lib/timers.js                 |  31 ++++--
 lib/tls.js                    |  69 ++++++++------
 lib/util.js                   |  18 +---
 node.gyp                      |  58 ++++++++++-
 src/atomic-polyfill.h         |  18 ++++
 src/env.h                     |   5 +
 src/node.cc                   | 182 +++++++++++++++++++++++++----------
 src/node.js                   |  11 +++
 src/node_buffer.cc            |  30 ++++--
 src/node_constants.cc         |   5 +
 src/node_contextify.cc        |   2 +-
 src/node_crypto.cc            | 207 +++++++++++++++++++++++++++++++++++-----
 src/node_crypto.h             |  24 ++---
 src/node_http_parser.cc       |  17 ++--
 src/node_lttng_provider.h     |  60 ++++++------
 src/node_version.h            |  11 +--
 src/node_watchdog.cc          |   9 +-
 src/node_watchdog.h           |   8 +-
 src/node_zlib.cc              |   6 +-
 tools/create_expfile.sh       |  48 ++++++++++
 tools/install.py              |   4 +
 tools/test-npm.sh             |  16 ++--
 47 files changed, 1138 insertions(+), 466 deletions(-)

Deps only; the only dependency upgraded other than npm in v5.0.0 was V8. Since this is a Major version bump of node and we are taking a new (“minor”) version of V8, the diff is extremely large, as such, the following is a shortened version:

   5.9% deps/v8/src/compiler/
   3.6% deps/v8/src/debug/
  11.6% deps/v8/src/full-codegen/
   3.2% deps/v8/src/mips/
   3.5% deps/v8/src/mips64/
   6.0% deps/v8/src/regexp/
  43.7% deps/v8/src/
   5.5% deps/v8/test/cctest/
   5.0% deps/v8/test/mjsunit/third_party/
   6.3% deps/v8/test/mjsunit/
   3.1% deps/v8/test/
 1113 files changed, 127450 insertions(+), 113137 deletions(-)

Docs only:

 CHANGELOG.md                           | 281 +++++++++++++++++++++++++++++--
 COLLABORATOR_GUIDE.md                  |  39 +++++
 WORKING_GROUPS.md                      |  48 ++++++
 deps/v8/infra/project-config/README.md |   1 -
 doc/api/assert.markdown                |  20 ++-
 doc/api/buffer.markdown                |  35 +++-
 doc/api/child_process.markdown         |  16 +-
 doc/api/cluster.markdown               |   5 +-
 doc/api/console.markdown               |  18 +-
 doc/api/crypto.markdown                |   4 +-
 doc/api/fs.markdown                    |  36 ++--
 doc/api/http.markdown                  |   5 +
 doc/api/process.markdown               |  46 +++--
 doc/api/tls.markdown                   |  96 ++++++++---
 doc/node.1                             | 146 +++++++++++-----
 doc/tsc-meetings/2015-09-30.md         | 161 ++++++++++++++++++
 doc/tsc-meetings/2015-10-07.md         | 102 +++++++++++
 doc/tsc-meetings/2015-10-14.md         | 121 +++++++++++++
 doc/tsc-meetings/2015-10-21.md         | 214 +++++++++++++++++++++++
 19 files changed, 1254 insertions(+), 140 deletions(-)

Tests & Benchmarks only:

   0.2% test/addons/async-hello-world/
   0.1% test/addons/heap-profiler/
   3.4% test/addons/make-callback/
   0.7% test/fixtures/
   0.4% test/internet/
   0.0% test/message/
  86.0% test/parallel/
   0.1% test/pummel/
   7.6% test/sequential/
   1.0% test/
 128 files changed, 2335 insertions(+), 433 deletions(-)

Most active commit

Of the 121 commits, d8011d1 was the most active (not counting npm updates):

commit d8011d1683fe0d977de2bea1147f5213d4490c5a  
Author: Michaël Zasso <mic.besace@gmail.com>  
Date:   Tue Oct 6 08:42:38 2015 +0200

    deps: upgrade V8 to 4.6.85.23

    PR-URL: https://github.com/nodejs/node/pull/3351
    Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com>
    Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>

   3.6% deps/v8/src/arm/  
   3.8% deps/v8/src/arm64/
   5.8% deps/v8/src/debug/
  18.7% deps/v8/src/full-codegen/
   3.4% deps/v8/src/ia32/
   3.6% deps/v8/src/mips/
   3.8% deps/v8/src/mips64/
   3.8% deps/v8/src/ppc/
   9.7% deps/v8/src/regexp/
   3.6% deps/v8/src/x64/
   3.4% deps/v8/src/x87/
  27.8% deps/v8/src/
   3.0% deps/v8/test/mjsunit/
   4.0% deps/v8/test/
 1114 files changed, 127167 insertions(+), 113376 deletions(-)

While v5 is necessary for the Node project, if your production complexity makes frequent upgrades painful, or if stability is a greater interest than quality-of-life features, we recommend you stay on Node v4 “Argon”, the LTS release line.

Quick patch releases will become routine though v5’s lifecycle. Expect a patch or minor release as soon as next week. There is a lot more effort being put into core than in the recent past and frequent releases mean that the work being done gets into your hands quicker.
We will be sure to let you know when a release contains a critical update and a recommendation to upgrade. Of course, we'd love you to upgrade, but this major upgrade is not in any way critical.