Comments:"What’s New in Node.js and libuv this Week"
URL:http://blog.strongloop.com/whats-new-in-node-js-and-libuv-april-25-2013/
Welcome to this week’s wrap up of the week in Node and libuv covering April 18-24. The purpose of this blog is to recap a subset of the non-documentation related commits to Node.js, plus give a little color and commentary to the ongoing development of Node.
Node v0.10.5 (Stable) is out!
An update to v0.10.5 dropped earlier this week with bug fixes and upgrades. Download v0.10.5 and read the official release notes on nodejs.org.
src: fix potential memory leak on early return
One omission to the release notes was a patch by Brian White (mscdex) that fixed a memory leak in crypto.Sign#final()
’s error path.
Node v0.11.1 (Unstable) is out!
An update to v0.11.1 was released on April 19th with bug fixes and upgrades. Download v0.11.1 and read the official release notes on nodejs.org.
Please note that this version upgraded V8 to 3.18.0 that unfortunately broke support for 64-bit Windows systems. A fix is expected in the next release.
This week’s Node master branch highlights:
build: fix ARM build after v8 upgrade
Ben Noordhuis (bnoordhuis) fixed the ARM build after V8 was upgraded, so if you are a Raspberry Pi user using Node to build embedded apps, rejoice!
path: add path.isAbsolute(path)
Ryan Doenges (hackedy) added an isAbsolute()
function to the the path module which means that now an absolute path will always open in the same location regardless of the current working directory. This addition fixed bug report #5299.
events: add EventEmitter.defaultMaxListeners
Ben added EventEmitter.defaultMaxListeners
, which is a global override of the default maxListeners value. It’s an old patch that had fallen through the cracks until the feature request was brought up again in issue #3014.
cluster: clean up lib/cluster.js
Ben rewrote the cluster module to clean up and DRY the cluster source code. In the process a few bugs were resolved. Here’s Ben’s commentary from the commit log:
- “Short-lived handles in long-lived worker processes were never reclaimed, resulting in resource leaks.
- Handles in the master process are now closed when the last worker that holds a reference to them quits. Previously, they were only closed at cluster shutdown.
- The cluster object no longer exposes functions/properties that are only valid in the ‘other’ process, e.g. cluster.fork() is no longer exported in worker processes.
So much goodness and still manages to reduce the line count from 590 to 320.”
Last but not least, you can now download Node.js nightly builds for all supported platforms!
Actually, this has been possible for a while, but it’s now officially advertised on the Node downloads page under “Nightly builds”
You can view the complete Node master commit history on GitHub.
This week’s libuv v0.10 branch highlights:
linux: don’t use fopen() in uv_resident_set_memory()
Ben made the output of uv_resident_set_memory(), process.memoryUsage().rss
in Node.js a little more reliable. uv_resident_set_memory() used to use fopen("/proc/self/stat")
to retrieve the number of RSS pages. However, RSS is a reflection of the number of pages that a process has mapped. glibc
implements fopen()
in terms of mmap()
which means that trying to read the number of mapped pages changes it, therefore the switch to open()
.
You can view the complete libuv v0.10 commit history on GitHub.
This week’s libuv master branch highlights:
unix: remove src/unix/cygwin.c
Ben removed Cygwin support in libuv. We are suspecting that nothing of value was lost here as it has been broken for the better part of a year and not a single bug was filed. This fact has been taken as a clear indication that no one actually uses it. If this isn’t the case, sound off!
unix, windows: add uv_has_ref() function
Saúl Ibarra Corretgé (saghul) added the uv_has_ref()
function to libuv. This is a convenience function for checking if a handle has been unref’d with uv_unref()
.
windows: deal with the fact that GetTickCount might lag
Bert Belder (piscisaureus) landed what Ben is describing as “a deeply evil patch” that “fixes” early timer expiry by changing the loop time. GetQueuedCompletionStatus(Ex)
is used to sleep a thread until the next timer expires. (This assumes that no other events have occurred before then.) The rub is that after waking up from sleep GetTickCount()
might return a value that reflects no time has passed. This can occur when gqcs
sleeps for a period of time shorter than the GetTickCount
clock resolution. The patch now forces accounting for the amount waited by gqcs
.
What’s the upside? According to Bert:
- “Excessive loop iterations are avoided
- Small timeouts are fired more precisely
- The `loop-stop` test that used to be flaky on Windows now passes consistently.”
Evil indeed!
You can view the complete libuv master commit history on GitHub.
This week’s blogs, tutorials, how-to’s and news
What’s Next?
Posted Thursday, April 25th, 2013. You can follow any comments to this entry through the RSS 2.0 feed. You can leave a comment, or trackback from your own site.