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

Some test cases fail when the node executable is built by --shared #18535

Closed
7 tasks done
yhwang opened this issue Feb 2, 2018 · 6 comments
Closed
7 tasks done

Some test cases fail when the node executable is built by --shared #18535

yhwang opened this issue Feb 2, 2018 · 6 comments
Labels
embedding Issues and PRs related to embedding Node.js in another project. test Issues and PRs related to the tests.

Comments

@yhwang
Copy link
Member

yhwang commented Feb 2, 2018

When use --shared option in configure, it would build the node in shared lib for people who embed node in their applications. It also uses the node_main.cc to build the node executable with the shared lib. When using this executable to run our existing test suites, the following test cases fail:

Ubuntu 16.04:

  • parallel/test-child-process-fork-exec-path
  • parallel/test-module-loading-globalpaths
  • parallel/test-postmortem-metadata
  • parallel/test-process-external-stdio-close
  • parallel/test-process-external-stdio-close-spawn
  • parallel/test-stdout-close-catch
  • abort/test-abort-backtrace

Maybe some of them are not suitable for shared lib build, maybe some are bugs. Fixing them would help us to have a CI job to build node in shared lib and verify it. This would also help embedding users to make sure the shared lib work. And we can start from Linux platform.

  • Platform: Linux
  • Subsystem: test
@yhwang
Copy link
Member Author

yhwang commented Feb 2, 2018

I am going to start to check the root causes for these test cases. I will update my finding here and fix if needed. Of course, comment/suggestion are welcome.

@addaleax addaleax added test Issues and PRs related to the tests. embedding Issues and PRs related to embedding Node.js in another project. labels Feb 2, 2018
@richardlau
Copy link
Member

parallel/test-module-loading-globalpaths copies the node executable into a temporary directory and runs the copy as some of the global paths are relative to where the binary is. I would guess that with the shared lib the copied node executable is unable to find/load the shared lib.

@yhwang
Copy link
Member Author

yhwang commented Feb 5, 2018

@richardlau

I would guess that with the shared lib the copied node executable is unable to find/load the shared lib.

You're right. And both parallel/test-child-process-fork-exec-path and parallel/test-module-loading-globalpaths share the same issue. In Linux platform, gyp uses rpath=$ORIGIN/lib.target to build the executable. One way to fix it is adding LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for macOS, LIBPATH for AIX) into process.env. Both of them passed when I tried this locally.

BridgeAR pushed a commit to BridgeAR/node that referenced this issue Feb 16, 2018
When building the node with `--shared` option, the major output is the
shared library. However, we still build a node executable which links
to the shared lib. It's for testing purpose. When testing with the
executable, some test cases move/copy the executable, change the
relative path to the shared library and fail. Using lib path env would
solve the issue. However, in macOS, need to change the install name for
the shared library and use rpath in the executable. In AIX, `-brtl`
linker option rebinds the symbols in the executable and addon modules
could use them.

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: nodejs#18626
Refs: nodejs#18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@yhwang
Copy link
Member Author

yhwang commented Feb 16, 2018

For parallel/test-process-external-stdio-close and parallel/test-process-external-stdio-close-spawn, the close callback gets SIGPIPE. So it would be pipe related issue, i.e. not able to write/receive data from the pipe. I will dig into that. If someone knows the possible cause, please chime in. Thanks.

yhwang added a commit to yhwang/node that referenced this issue Feb 20, 2018
When building the node with `--shared` option, we need
to verify the symbols in shared lib instead of executable.

Refs: nodejs#18535

Signed-off-by: Yihong Wang <[email protected]>
MylesBorins pushed a commit that referenced this issue Feb 21, 2018
When building the node with `--shared` option, the major output is the
shared library. However, we still build a node executable which links
to the shared lib. It's for testing purpose. When testing with the
executable, some test cases move/copy the executable, change the
relative path to the shared library and fail. Using lib path env would
solve the issue. However, in macOS, need to change the install name for
the shared library and use rpath in the executable. In AIX, `-brtl`
linker option rebinds the symbols in the executable and addon modules
could use them.

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: #18626
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
MylesBorins pushed a commit that referenced this issue Feb 21, 2018
When building the node with `--shared` option, the major output is the
shared library. However, we still build a node executable which links
to the shared lib. It's for testing purpose. When testing with the
executable, some test cases move/copy the executable, change the
relative path to the shared library and fail. Using lib path env would
solve the issue. However, in macOS, need to change the install name for
the shared library and use rpath in the executable. In AIX, `-brtl`
linker option rebinds the symbols in the executable and addon modules
could use them.

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: #18626
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
addaleax pushed a commit that referenced this issue Feb 21, 2018
When building the node with `--shared` option, we need
to verify the symbols in shared lib instead of executable.

Refs: #18535

Signed-off-by: Yihong Wang <[email protected]>
PR-URL: #18806
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
MylesBorins pushed a commit that referenced this issue Mar 6, 2018
When building the node with `--shared` option, we need
to verify the symbols in shared lib instead of executable.

Refs: #18535

Signed-off-by: Yihong Wang <[email protected]>
PR-URL: #18806
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
MylesBorins pushed a commit that referenced this issue Mar 6, 2018
When building the node with `--shared` option, we need
to verify the symbols in shared lib instead of executable.

Refs: #18535

Signed-off-by: Yihong Wang <[email protected]>
PR-URL: #18806
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
yhwang added a commit to yhwang/node that referenced this issue Mar 7, 2018
When using shared lib build, the binary path in the stack frames points
to shared lib. Change the checking criteria in the test case to match
that.

Refs: nodejs#18535

Signed-off-by: Yihong Wang <[email protected]>
yhwang added a commit to yhwang/node that referenced this issue Mar 9, 2018
For shared lib build, we leave the signal handling for embedding users.
In these two test cases:
- `parallel/test-process-external-stdio-close-spawn`
- `parallel/test-process-external-stdio-close`

The pipe is used for stdout and is destroied before child process uses
it for logging. So the node executble that uses shared lib build
receives SIGPIPE and the child process ends.

This change ignores the SIGPIPE in node_main.cc for shared lib case.

Refs: nodejs#18535

Signed-off-by: Yihong Wang <[email protected]>
BridgeAR pushed a commit to BridgeAR/node that referenced this issue Mar 11, 2018
When using shared lib build, the binary path in the stack frames points
to shared lib. Change the checking criteria in the test case to match
that.

Refs: nodejs#18535

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: nodejs#19213
Refs: nodejs#18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
yhwang added a commit that referenced this issue Mar 13, 2018
For shared lib build, we leave the signal handling for embedding users.
In these two test cases:
- `parallel/test-process-external-stdio-close-spawn`
- `parallel/test-process-external-stdio-close`

The pipe is used for stdout and is destroied before child process uses
it for logging. So the node executble that uses shared lib build
receives SIGPIPE and the child process ends.

This change ignores the SIGPIPE in node_main.cc for shared lib case.

Refs: #18535

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: #19211
Refs: #18535
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
@yhwang
Copy link
Member Author

yhwang commented Mar 13, 2018

kicked off a Linux CI to verify the current master code base with shared lib build:
https://ci.nodejs.org/job/node-test-commit-linux-as-shared-lib/5/nodes=ubuntu1404-64/
I will update the result later

@yhwang
Copy link
Member Author

yhwang commented Mar 13, 2018

All tests passed in the CI job above. Seems #19211 fixed parallel/test-stdout-close-catch as well. Next step is to enable the shared-lib CI job (only Linux) for regular PR CI. I think it's time to close this issue.

@yhwang yhwang closed this as completed Mar 13, 2018
targos pushed a commit that referenced this issue Mar 17, 2018
When using shared lib build, the binary path in the stack frames points
to shared lib. Change the checking criteria in the test case to match
that.

Refs: #18535

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: #19213
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit that referenced this issue Mar 17, 2018
For shared lib build, we leave the signal handling for embedding users.
In these two test cases:
- `parallel/test-process-external-stdio-close-spawn`
- `parallel/test-process-external-stdio-close`

The pipe is used for stdout and is destroied before child process uses
it for logging. So the node executble that uses shared lib build
receives SIGPIPE and the child process ends.

This change ignores the SIGPIPE in node_main.cc for shared lib case.

Refs: #18535

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: #19211
Refs: #18535
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
MylesBorins pushed a commit that referenced this issue Mar 20, 2018
When using shared lib build, the binary path in the stack frames points
to shared lib. Change the checking criteria in the test case to match
that.

Refs: #18535

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: #19213
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this issue Mar 20, 2018
For shared lib build, we leave the signal handling for embedding users.
In these two test cases:
- `parallel/test-process-external-stdio-close-spawn`
- `parallel/test-process-external-stdio-close`

The pipe is used for stdout and is destroied before child process uses
it for logging. So the node executble that uses shared lib build
receives SIGPIPE and the child process ends.

This change ignores the SIGPIPE in node_main.cc for shared lib case.

Refs: #18535

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: #19211
Refs: #18535
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
MayaLekova pushed a commit to MayaLekova/node that referenced this issue May 8, 2018
When building the node with `--shared` option, the major output is the
shared library. However, we still build a node executable which links
to the shared lib. It's for testing purpose. When testing with the
executable, some test cases move/copy the executable, change the
relative path to the shared library and fail. Using lib path env would
solve the issue. However, in macOS, need to change the install name for
the shared library and use rpath in the executable. In AIX, `-brtl`
linker option rebinds the symbols in the executable and addon modules
could use them.

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: nodejs#18626
Refs: nodejs#18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
MayaLekova pushed a commit to MayaLekova/node that referenced this issue May 8, 2018
When building the node with `--shared` option, we need
to verify the symbols in shared lib instead of executable.

Refs: nodejs#18535

Signed-off-by: Yihong Wang <[email protected]>
PR-URL: nodejs#18806
Refs: nodejs#18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
MayaLekova pushed a commit to MayaLekova/node that referenced this issue May 8, 2018
When using shared lib build, the binary path in the stack frames points
to shared lib. Change the checking criteria in the test case to match
that.

Refs: nodejs#18535

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: nodejs#19213
Refs: nodejs#18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MayaLekova pushed a commit to MayaLekova/node that referenced this issue May 8, 2018
For shared lib build, we leave the signal handling for embedding users.
In these two test cases:
- `parallel/test-process-external-stdio-close-spawn`
- `parallel/test-process-external-stdio-close`

The pipe is used for stdout and is destroied before child process uses
it for logging. So the node executble that uses shared lib build
receives SIGPIPE and the child process ends.

This change ignores the SIGPIPE in node_main.cc for shared lib case.

Refs: nodejs#18535

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: nodejs#19211
Refs: nodejs#18535
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
MylesBorins pushed a commit that referenced this issue Aug 7, 2018
When building the node with `--shared` option, the major output is the
shared library. However, we still build a node executable which links
to the shared lib. It's for testing purpose. When testing with the
executable, some test cases move/copy the executable, change the
relative path to the shared library and fail. Using lib path env would
solve the issue. However, in macOS, need to change the install name for
the shared library and use rpath in the executable. In AIX, `-brtl`
linker option rebinds the symbols in the executable and addon modules
could use them.

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: #18626
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
MylesBorins pushed a commit that referenced this issue Aug 7, 2018
When building the node with `--shared` option, we need
to verify the symbols in shared lib instead of executable.

Refs: #18535

Signed-off-by: Yihong Wang <[email protected]>
PR-URL: #18806
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
MylesBorins pushed a commit that referenced this issue Aug 7, 2018
When building the node with `--shared` option, the major output is the
shared library. However, we still build a node executable which links
to the shared lib. It's for testing purpose. When testing with the
executable, some test cases move/copy the executable, change the
relative path to the shared library and fail. Using lib path env would
solve the issue. However, in macOS, need to change the install name for
the shared library and use rpath in the executable. In AIX, `-brtl`
linker option rebinds the symbols in the executable and addon modules
could use them.

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: #18626
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
MylesBorins pushed a commit that referenced this issue Aug 7, 2018
When building the node with `--shared` option, we need
to verify the symbols in shared lib instead of executable.

Refs: #18535

Signed-off-by: Yihong Wang <[email protected]>
PR-URL: #18806
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
MylesBorins pushed a commit that referenced this issue Aug 9, 2018
When building the node with `--shared` option, the major output is the
shared library. However, we still build a node executable which links
to the shared lib. It's for testing purpose. When testing with the
executable, some test cases move/copy the executable, change the
relative path to the shared library and fail. Using lib path env would
solve the issue. However, in macOS, need to change the install name for
the shared library and use rpath in the executable. In AIX, `-brtl`
linker option rebinds the symbols in the executable and addon modules
could use them.

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: #18626
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
MylesBorins pushed a commit that referenced this issue Aug 9, 2018
When building the node with `--shared` option, we need
to verify the symbols in shared lib instead of executable.

Refs: #18535

Signed-off-by: Yihong Wang <[email protected]>
PR-URL: #18806
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
MylesBorins pushed a commit that referenced this issue Aug 16, 2018
When building the node with `--shared` option, the major output is the
shared library. However, we still build a node executable which links
to the shared lib. It's for testing purpose. When testing with the
executable, some test cases move/copy the executable, change the
relative path to the shared library and fail. Using lib path env would
solve the issue. However, in macOS, need to change the install name for
the shared library and use rpath in the executable. In AIX, `-brtl`
linker option rebinds the symbols in the executable and addon modules
could use them.

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: #18626
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
MylesBorins pushed a commit that referenced this issue Aug 16, 2018
When building the node with `--shared` option, we need
to verify the symbols in shared lib instead of executable.

Refs: #18535

Signed-off-by: Yihong Wang <[email protected]>
PR-URL: #18806
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
jasnell pushed a commit to jasnell/node that referenced this issue Aug 17, 2018
When using shared lib build, the binary path in the stack frames points
to shared lib. Change the checking criteria in the test case to match
that.

Refs: nodejs#18535

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: nodejs#19213
Refs: nodejs#18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this issue Sep 6, 2018
When using shared lib build, the binary path in the stack frames points
to shared lib. Change the checking criteria in the test case to match
that.

Refs: #18535

Signed-off-by: Yihong Wang <[email protected]>

Backport-PR-URL: #22380
PR-URL: #19213
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
BethGriggs pushed a commit that referenced this issue Mar 21, 2019
For shared lib build, we leave the signal handling for embedding users.
In these two test cases:
- `parallel/test-process-external-stdio-close-spawn`
- `parallel/test-process-external-stdio-close`

The pipe is used for stdout and is destroied before child process uses
it for logging. So the node executble that uses shared lib build
receives SIGPIPE and the child process ends.

This change ignores the SIGPIPE in node_main.cc for shared lib case.

Refs: #18535

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: #19211
Refs: #18535
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Signed-off-by: Beth Griggs <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
embedding Issues and PRs related to embedding Node.js in another project. test Issues and PRs related to the tests.
Projects
None yet
Development

No branches or pull requests

3 participants