Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

deps: uv 1.4.0 update #9179

Closed
wants to merge 7 commits into from
Closed

deps: uv 1.4.0 update #9179

wants to merge 7 commits into from

Conversation

trevnorris
Copy link

Update libuv to 1.4.0 and land a fix that changed default behavior to preserve backwards compatibility.

R=@tjfontaine @misterdjules

var proc = fork(__filename, ['child']);

proc.on('message', common.mustCall(function(msg) {
assert.equal(typeof msg , 'string');
Copy link
Member

Choose a reason for hiding this comment

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

Style nit: space before comma. :-)

Copy link
Author

Choose a reason for hiding this comment

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

heh. thanks. I just did a replace on the () that were there.

@misterdjules
Copy link

I’m not sure about the impact of * win, unix: add pipe_peername implementation on backward compatibility. It's a new API that is not present in v0.12.0. Users could write native modules using this libuv API for node v0.12.1, but these modules would break on platforms where an older libuv 1.x is shipped as a dynamic library, and where Node.js is built to load libuv dynamically.

Are there platforms doing that currently, and if so what version of libuv do they track/ship?

EDIT: Regarding backward compatibility, I also wonder if libuv/libuv#156 could , by introducing an important behavior change that is sort of an API change, break users of such platforms.

@misterdjules
Copy link

Just for the record, the build fails on SmartOS currently.

This build issue had been fixed by the fact that the tty related change had been reverted. At some point later, it was put back, but in a version of libuv > 1.02 if I remember correctly. I had sent a PR that fixed the original breaking change, I'm not sure if it still applies though.

@misterdjules
Copy link

I think we should also track an issue to add dtrace probes support back. In my opinion it's very useful for some users and I would like to at least track it somewhere. Thoughts?

@misterdjules
Copy link

@trevnorris The SmartOS build is fixed by misterdjules@8ba154b, and I reworded the header of e0b44d6 into misterdjules@137d331.

The SmartOS build fix will need to be upstreamed, should we float the patch first and upstream it, or upstream it first so that we don't have to patch it (but that would delay the upgrade)?

@tjfontaine
Copy link

General Dependency Upgrades

Since Node.js doesn't currently define its own API/ABI the only way for users to build and ship binary addons is by building against the libuv and V8 that Node.js releases are built against (and in turn shipped). This also applies to c-ares, zlib, openssl, etc

We can upgrade any of our tightly coupled dependencies in a patch release, so long as those upgrades meet a couple requirements:

  • No public symbols that Node.js is linking against may be removed
  • All public symbols must behave in the way they did in the previous version, less any fixed bugs
    • bugs are generally described as fixed behavior that wasn't working as documented, or that the user couldn't have been explicitly/implicitly depending on
  • No breaking ABI changes for artifacts currently built and linked against the old version

Presuming the upgrade to the library meets those requirements, the only follow up to that is:

  • Node.js must not use any new symbols/APIs

Since we support/allow building and linking against shared versions of our dependencies, consumers may not upgrade them in sync, so the node binary (and also their binary addons) must continue to work with whatever version of the shared library they have installed.

This Upgrade

From an API/ABI perspective most of this looks fine, save for the change to uv_tty_set_mode. I think in practice we're probably fine changing the int to enum but this is indeed one of those portions where the size of the enum is implementation defined, and can be one of those places where ABI is easily broken.

While there is a C++ level API compatibility change, what's not entirely clear is if the int to enum change is ABI compliant for people using only C.

I have not evaluated all the behavioral changes to know any further potential impacts.

@misterdjules
Copy link

@misterdjules
Copy link

It also seems to break a lot of tests on Windows. I haven't had the time to investigate those though.

@trevnorris
Copy link
Author

I might have missed a floating patch, though I thought that's what "lib: fix stdio/ipc sync i/o regression" was supposed to fix.

@orangemocha
Copy link
Contributor

Investigating those Windows failures....

@orangemocha
Copy link
Contributor

I haven't completed the investigation yet (I will resume on Monday), but I have determined that the second commit in this PR (42371f7) and not the libuv uddate is causing the WIndows child_process-related failures.
cc @bnoordhuis

@bnoordhuis
Copy link
Member

See nodejs/node#774 - apparently blocking pipe I/O is not (always?) supported on Windows but to what extent is unclear to me.

@orangemocha
Copy link
Contributor

I have opened a PR in libuv that addresses the blocking pipe issues on Windows. I think we'll have to float a patch on here. @trevnorris is it ok for me to add a commit to this PR?

@trevnorris
Copy link
Author

@orangemocha be my guest.

@trevnorris trevnorris force-pushed the uv-1.4.0-update branch 2 times, most recently from 9b4db67 to 14f00ed Compare March 3, 2015 19:48
@trevnorris
Copy link
Author

@orangemocha Thanks for the PR, and great work! I've already cherry-picked your commit onto this PR.

@misterdjules This should be gtg for another test on Jenkins.

@orangemocha
Copy link
Contributor

Thanks! Let's see what Jenkins says: http://jenkins.nodejs.org/job/node-accept-pull-request/26/ (testing only)

@trevnorris
Copy link
Author

I could use some help on this one. I don't have OSX, and can't find a single change regards to a -static option.

Because we are floating several patches on top of libuv, make that
apparent in the version number.
@trevnorris
Copy link
Author

@saghul something like c515187

@saghul
Copy link
Member

saghul commented Mar 18, 2015

I could use some help on this one. I don't have OSX, and can't find a single change regards to a -static option.

It doesn't seem to be a libuv issue, but an issue on the OSX machine. All static libraries are failing to compile there.

@saghul
Copy link
Member

saghul commented Mar 18, 2015

@trevnorris yeah, that will do, thanks a lot!

@misterdjules
Copy link

@orangemocha @trevnorris @saghul The build issue on OSX was due to a problem in the build slave configuration, and I'm the one who broke it when fixing the libuv jenkins job. My apologies for that. It should be fixed now, but let me know if you still have issues with it. Sorry again!

@misterdjules
Copy link

@saghul @trevnorris FWIW, I'm fine with @saghul's suggestion in #9179 (comment) and with @trevnorris' change.

@misterdjules
Copy link

@@ -138,6 +138,7 @@ extern "C" {
XX(EOF, "end of file") \
XX(ENXIO, "no such device or address") \
XX(EMLINK, "too many links") \
XX(EHOSTDOWN, "host is down") \

Choose a reason for hiding this comment

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

That seems like another API change that might be a bit more difficult not to use within the node code base, but at that point I don't know what other options we have.

Copy link
Author

Choose a reason for hiding this comment

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

agreed.

@misterdjules
Copy link

@joyent/node-coreteam besides the API changes, including the latest one in a 1.4.x patch release, LGTM.

Do we have any option other than just landing these API changes in node? Any other way of moving forward I can think of requires a lot of maintenance from node for which we don't have proper tooling right now.

@saghul
Copy link
Member

saghul commented Mar 19, 2015

@misterdjules: That change is somewhere between a bugfix and an API change. libuv doesn't use the symbol but some OS-es generate it so we now export it. The alternative is an assert, which quite some people where getting while downloading packages with NPM, for example, which is not desired.

FWIW this particular change can be "ifdef tested".

@misterdjules
Copy link

@trevnorris Assigned to you, let me know if you have any trouble running the node-accept-pull-request job on Jenkins. Thank you!

@misterdjules
Copy link

@saghul OK, my concern was more that someone using UV_EHOSTDOWN with a given v1.4.x release will get a compilation error with another v1.4.x release that doesn't define this value, unless I'm missing something.

@saghul
Copy link
Member

saghul commented Mar 19, 2015

@misterdjules that is indeed a possibility, unfortunately.

trevnorris added a commit that referenced this pull request Mar 19, 2015
Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
PR-URL: #9179
trevnorris added a commit that referenced this pull request Mar 19, 2015
The -fno-strict-aliasing flag was added to fix compilation warnings when
building Node.js with GCC <= 4.4

Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
PR-URL: #9179
trevnorris pushed a commit that referenced this pull request Mar 19, 2015
process.send() should be synchronous, it should block until the message
has been sent in full, but it wasn't after the second-to-last libuv
upgrade because of commit libuv/libuv@393c1c5 ("unix: set non-block
mode in uv_{pipe,tcp,udp}_open"), which made its way into io.js in
commit 07bd05b ("deps: update libuv to 1.2.1").

Commit libuv/libuv@b36d4ff ("unix: implement uv_stream_set_blocking()")
as landed in io.js in commit 9681fca ("deps: update libuv to 1.4.0")
makes it possible to restore the synchronous behavior again and that's
precisely what this commit does.

The same line of reasoning applies to `net.Socket({ fd: 1 })`: creating
a socket object from a stdio file descriptor, like the `process.stdout`
getter does, should put the file descriptor in blocking mode for
compatibility reasons.

Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
PR-URL: #9179
orangemocha added a commit that referenced this pull request Mar 19, 2015
Float patch to fix pipe on Windows. Original commit message:

  win: fix pipe blocking writes

  In the code path for pipe blocking writes, WriteFile is already
  posting a completion packet to the I/O completion port.
  POST_COMPLETION_FOR_REQ was causing the same request to get
  returned twice by GetCompletionStatusEx.
  Also on the same code path, we were waiting on the wrong event.

  We need to update queued_bytes and write_queue_size when a
  blocking write request completes asynchronously.

Ref: libuv/libuv#238

Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
PR-URL: #9179
misterdjules pushed a commit that referenced this pull request Mar 19, 2015
Float patch to fix setsockopt for multicast on Solaris and derivatives.
Original commit message:

  solaris: fix setsockopt for multicast options

  On Solaris and derivatives such as SmartOS, the length of socket options
  for multicast and ttl options is not always sizeof(char).

  This fixes the udp_options and udp_options6 tests.

Ref: libuv/libuv#243

Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
PR-URL: #9179
trevnorris pushed a commit that referenced this pull request Mar 19, 2015
Original commit message:

  darwin: fix size calculation in select() fallback

  Apple's `fd_set` stores its bits in an array of 32-bit integers, which
  means `FD_ISSET()` may read out of bounds if we allocate storage at
  byte granularity. There's also a chance that the `select()` call could
  corrupt the heap, although I didn't investigate that.

  This issue was discovered by LLVM's AddressSanitizer which caught
  `FD_ISSET()` trying to read out of bounds.

Ref: libuv/libuv#241

Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
PR-URL: #9179
trevnorris added a commit that referenced this pull request Mar 19, 2015
Because we are floating several patches on top of libuv, make that
apparent in the version number.

Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
PR-URL: #9179
@misterdjules
Copy link

Landed in 7a37910, c0766eb, 2411bea, 3cce8ab, 9613ac7, 2fdeb7e and a930870.

Thank you @trevnorris @saghul, @orangemocha and everyone involved 👍

misterdjules pushed a commit to misterdjules/node that referenced this pull request May 7, 2015
The -fno-strict-aliasing flag was added to fix compilation warnings when
building Node.js with GCC <= 4.4

Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
PR-URL: nodejs#9179
misterdjules pushed a commit to misterdjules/node that referenced this pull request May 12, 2015
The -fno-strict-aliasing flag was added to fix compilation warnings when
building Node.js with GCC <= 4.4

Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
PR-URL: nodejs#9179

PR: nodejs#25141
PR-URL: nodejs#25141
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Julien Gilli <jgilli@fastmail.fm>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants