Welcome to this week’s wrap up of the week in Node and libuv covering May 9 through May 15. 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.
This week’s Node v0.10 branch highlights
debugger: breakpoints in scripts not loaded yet
Miroslav Bajtoš (bajtos) debugger patch got backported to v0.10 in a32a243. If you recall from the last update, this patch calls setBreakpoint with an unknown script name and converts the script name into a regular expression matching all paths ending with a given name (name can be a relative path too).
stream: make Readable.wrap support empty streams
stream: make Readable.wrap support objectMode
child_process: fix handle delivery
Ben Noordhuis (bnoordhuis) fixed a bug in 21bd456 where handles / file descriptors were sometimes delivered to the wrong message when sending them to other processes. As Ben points out, “the exact issue is rather complex, but the commit log goes into excruciating detail.” So, if you want to dig deep on this one, check the commit log.
src: Add StringBytes static util class
crypto: Pass encodings to C++ for Sign/Verify
Isaac Schlueter (isaacs) tackled crypto string performance with a variety of commits. For those who have looked at the performance of crypto strings in v0.10, you know there was a big regression in v0.10 compared to v0.8.
timers: fix setInterval() assert
Ben fixed a bug in 22533c0 that was causing Node to hit a C++ assert when you unref’d a setInterval() timer in a particular way.
buffer, crypto: fix default encoding regression
You can view the complete Node v0.10 commit history on GitHub.
This week’s Node master branch highlights
debugger, cluster: each worker has new debug port
Miroslav fixed the debugger when used against clustered applications in commit 43ec1b1. Current users of the debugger will recall that it used to be that all processes tried to bind to the same TCP port – which of course we know doesn’t work. With this fix each process now binds to a different port in ascending order. Node no also understands –debug-port=<port>, which tells it to claim the port, but to not start the debugger just yet.
os: Include netmask in os.networkInterfaces()
http: Use writev instead of the hacky hot end
Now there’s an interesting title for a commit! In this commit Isaac made the http module use the writev() API. It replaces about 100 lines of code which did what writev() does, but in an ad-hoc manner.
fs.watch on OSX returns file paths
After the upgrade to libuv v0.11.2 in fede68f, fs.watch() on OS X finally returns file paths and even tracks renames.
v8 upgraded to 3.19.0
Ben upgraded V8 to 3.19.0 in commit 7ee538d. This is the first V8 release that supports Harmony generators: –harmony_generators. If you are a native add-on authors the new V8 API has some backwards incompatible changes.
util: make util.log handle non strings like console.log
cluster: use round-robin load balancing
Ben made the cluster module use the round-robin load balancing algorithm (except on Windows) in commit e72cd41. The commit log has the details of the why and how. In a nutshell: more predictable load distribution.
deps: upgrade c-ares to 1.10.0
Ben upgraded the bundled c-ares from 1.9 to 1.10 in commit 9498fd1.
dns: add getServers and setServers
- getServers returns an array of ips that are currently being used for resolution
- setServers takes an array of IPs that are to be used for resolution. This will throw an exception if there’s invalid input, but preserve the original configuration
net: emit dns ‘lookup’ event before connect
Ben made net.connect() and net.createConnection() emit a DNS ‘lookup’ event in commit b3d1e50. This is useful if you want to instrument your code or profile DNS resolve times.
http: don’t escape request path, reject bad chars
Ben reworked the http request path escaping approach in 7124387 (originally introduced in 38149bb.) It no longer escapes, just checks for invalid characters. More details in the commit log for details. This is great for folks who were finding it next to impossible to be compatible with both v0.10 and v0.11+ without undue effort.
dtrace: enable uv’s probes if enabled
TJ Fontaine enabled the embedded libuv’s dtrace probes in f0d80d7. The current probes remain quite basic, but they do let you for example, time how long a tick of the event loop took.
You can view the complete Node master commit history on GitHub.
This week’s libuv v0.10 branch highlights:
EMFILE handling on Linux
Ben fixed an EMFILE handling bug in commit b3ab332. The behavior people were reporting was that on Linux (and only Linux), Node processes would start busy-looping and eating 100% CPU. The culprit here was how the kernel’s accept() syscall checks for EMFILE before checking for EAGAIN. This threw off the EMFILE handling code in libuv.
build: set soname in shared library
In 3eb6eb3 Ben addressed a popular request from distro packagers, that the shared object file (
make libuv.so) now set the soname. TJ came in afterwards and applied fix 55c150a because the SunOS ld linker doesn’t like -soname in non-dynamic builds.
darwin: fix iOS build, don’t require Application Services
Ben fixed the iOS build in f22163c.
windows: kill child processes when the parent dies
windows: make uv_spawn not fail under job control
Bert fixed uv_spawn() in commit 4f61ab2 to not fail when running
under job control.
You can view the complete libuv v0.10 commit history on GitHub.