Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PipeWrap to use uv_pipe_bind2 and uv_pipe_connect2 to restore ability to connect to abstract domain sockets #49667

Merged
merged 2 commits into from
Sep 18, 2023

Conversation

ggoodman
Copy link
Contributor

This PR moves PipeWrap from the classic uv_pipe_bind and uv_pipe_connect methods to their newer uv_pipe_bind2 and uv_pipe_connect2 counterparts. This restores support for connecting to abstract unix domain sockets. Support was lost due to the refactor in libuv/libuv#4030 where uv_pipe_bind and uv_pipe_connect now infer the length of the pathname using strlen(). For an abstract unix socket, this was producing 0. Moving to uv_pipe_bind2 and uv_pipe_connect2 allows us to pass an explicit size_t for the socket path based on the length of the v8 string.

Fixes: #49656

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. net Issues and PRs related to the net subsystem. labels Sep 15, 2023
@ggoodman
Copy link
Contributor Author

Alright, here we go @santigimeno. I think I got the commit message guidelines down. Looking for feedback on the test. It should do the thing but might not be at the peak of elegance or codebase best practices.

Also, since I'm expecting to make changes; is rebasing ok or do we prefer new fix commits for review purposes?

Copy link
Member

@santigimeno santigimeno left a comment

Choose a reason for hiding this comment

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

Mostly looking good. Left some comments. Also a good idea is for you to test if the linter passes: make lint.

test/parallel/test-pipe-abstract-socket-http.js Outdated Show resolved Hide resolved
test/parallel/test-pipe-abstract-socket-http.js Outdated Show resolved Hide resolved
@ggoodman
Copy link
Contributor Author

@santigimeno turns out the guide you linked has almost exactly the test I wanted. I added an extra common.mustCall to ensure that the server successfully binds and calls the "listening" callback. Looks nice and tight now.

Copy link
Member

@lpinca lpinca left a comment

Choose a reason for hiding this comment

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

LGMT with lint issues fixed

Copy link
Member

@santigimeno santigimeno left a comment

Choose a reason for hiding this comment

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

LGTM. Great work!

@ggoodman
Copy link
Contributor Author

Ugh, copy paste mistake. Fixing.

The introduction of the uv_pipe_bind2 and uv_pipe_connect2 methods in
libuv v1.46.0 changed the behaviour of uv_pipe_bind and uv_pipe_connect.
This broke the ability to connect to abstract domain sockets on linux.
This change ports PipeWrap to use the new uv_pipe_bind2 and
uv_pipe_connect2 methods to restore abstract domain socket support.

Fixes: nodejs#49656
Refs: libuv/libuv#4030
Introduce a new linux-only test for binding to an abstract unix socket
and then making an http request against that socket.

Refs: nodejs#49656
@debadree25 debadree25 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Sep 15, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 15, 2023
@nodejs-github-bot
Copy link
Collaborator

@ggoodman
Copy link
Contributor Author

Seems like the osx11-x64 configuration in CI is having a bad day. Is the CI failure related or unrelated?

@debadree25
Copy link
Member

Looks unrelated will restart ci

@nodejs-github-bot
Copy link
Collaborator

@debadree25 debadree25 added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Sep 18, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 18, 2023
@nodejs-github-bot nodejs-github-bot merged commit 553169f into nodejs:main Sep 18, 2023
33 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 553169f

@debadree25
Copy link
Member

Thank you for your contribution @ggoodman 🚀

ruyadorno pushed a commit that referenced this pull request Sep 28, 2023
The introduction of the uv_pipe_bind2 and uv_pipe_connect2 methods in
libuv v1.46.0 changed the behaviour of uv_pipe_bind and uv_pipe_connect.
This broke the ability to connect to abstract domain sockets on linux.
This change ports PipeWrap to use the new uv_pipe_bind2 and
uv_pipe_connect2 methods to restore abstract domain socket support.

Fixes: #49656
Refs: libuv/libuv#4030
PR-URL: #49667
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
This was referenced Sep 28, 2023
alexfernandez pushed a commit to alexfernandez/node that referenced this pull request Nov 1, 2023
The introduction of the uv_pipe_bind2 and uv_pipe_connect2 methods in
libuv v1.46.0 changed the behaviour of uv_pipe_bind and uv_pipe_connect.
This broke the ability to connect to abstract domain sockets on linux.
This change ports PipeWrap to use the new uv_pipe_bind2 and
uv_pipe_connect2 methods to restore abstract domain socket support.

Fixes: nodejs#49656
Refs: libuv/libuv#4030
PR-URL: nodejs#49667
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
deokjinkim added a commit to deokjinkim/node that referenced this pull request Nov 10, 2023
We need to handle errors from uv_pipe_connect2()
because return type is `int`.

Fixes: nodejs#50652
Refs: nodejs#49667
Refs: libuv/libuv#4030
deokjinkim added a commit to deokjinkim/node that referenced this pull request Nov 10, 2023
We need to handle errors from uv_pipe_connect2()
because return type is `int`.

Fixes: nodejs#50652
Refs: nodejs#49667
Refs: libuv/libuv#4030
nodejs-github-bot pushed a commit that referenced this pull request Nov 12, 2023
We need to handle errors from uv_pipe_connect2()
because return type is `int`.

Fixes: #50652
Refs: #49667
Refs: libuv/libuv#4030
PR-URL: #50657
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: theanarkh <[email protected]>
targos pushed a commit that referenced this pull request Nov 23, 2023
We need to handle errors from uv_pipe_connect2()
because return type is `int`.

Fixes: #50652
Refs: #49667
Refs: libuv/libuv#4030
PR-URL: #50657
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: theanarkh <[email protected]>
nodejs-github-bot pushed a commit that referenced this pull request Nov 28, 2023
PR-URL: #50904
Refs: #49667
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
targos pushed a commit that referenced this pull request Dec 4, 2023
PR-URL: #50904
Refs: #49667
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
UlisesGascon pushed a commit that referenced this pull request Dec 11, 2023
We need to handle errors from uv_pipe_connect2()
because return type is `int`.

Fixes: #50652
Refs: #49667
Refs: libuv/libuv#4030
PR-URL: #50657
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: theanarkh <[email protected]>
richardlau pushed a commit that referenced this pull request Mar 25, 2024
PR-URL: #50904
Refs: #49667
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. net Issues and PRs related to the net subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to libuv version 1.46.0 broke connecting to abstract unix sockets
6 participants