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!
src: fix potential memory leak on early return
Node v0.11.1 (Unstable) is out!
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
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
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
- “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.
fopen() in terms of
mmap() which means that trying to read the number of mapped pages changes it, therefore the switch to
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
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
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.”
You can view the complete libuv master commit history on GitHub.