Comments (23)
perhaps add DYLD_INSERT_LIBRARIES
as well? and add to mirrord.dev?
from mirrord.
@t4lz suggested it might be because node is signed, but node is same node users had before the upgrade, so it's irrelevant.
In order to test it, I stripped the signature from turbo's Node and this still occurs.
I found that this command also reproduces it (needs to have "tampered binaries" for it to occur, atleast one run as @t4lz described)
mirrord exec /var/folders/2h/fn_s1t8n0cqfc9x71yq845m40000gn/T/mirrord-bin/usr/bin/env node /var/folders/2h/fn_s1t8n0cqfc9x71yq845m40000gn/T/mirrord-bin/Users/aviramhassan/Code/mirrord-sip-npm-issue/node_modules/.bin/turbo run dev
If that's not weird enough, I just get an empty line break if I try
mirrord exec env node turbo run dev
from mirrord.
Also this
mirrord exec env node /Users/aviramhassan/Code/mirrord-sip-npm-issue/node_modules/.bin/turbo run dev
from mirrord.
I found out that if you add --no-daemon
to the command it works - I saw it connects to a socket and my theory now is that the script sends to the daemon it's path to load stuff for it, and we don't cover that flow.
Edit:
Nope, tester error.
from mirrord.
ok, @t4lz might be right it being related to node being signed, since all the tester issues was actually when I tried to codesign to see if that fixes it, but each time I tried a different node binary (nvm vs volta) and when I patched both it always worked.
from mirrord.
I feel like calling exec
ourselves will create issues, especially when from extension.
I think a better solution would be to ship a binary that will act as the interpreter, and we'll just change the sip patch logic to it -> mirrordsh
will be a binary that receives arguments to binary to call but will make sure mirrord is loaded (via dlopen?) then do it. SIP patch will now just prepend mirrordsh
- probably we can bundle that binary like we bundle the dylib?
from mirrord.
I thought it might be getcwd
but nope :(
from mirrord.
I thought it might be
getcwd
but nope :(
I think we should be looking at ways an application can get the current executable's path, not the CWD's path.
from mirrord.
This is where node threw an error for the user that faced this issue: https://github.com/nodejs/node/blob/v18.17.0/lib/internal/modules/cjs/loader.js#L1080
from mirrord.
I know - I checked all symbols that are related to file access - Node needs to read the file and I can't see any access to it via any APIs. - I was looking for an API that has ../lib/cli.js
or part of it.
Given it only happens with Turbo, I assume it might be Turbo doing something funky?
https://github.com/vercel/turbo/blob/main/crates/turbopack-cli/src/dev/mod.rs#L68
from mirrord.
Here is the node error the user got, the one I got and posted in the issue's text is unfortunately a bit different:
│ node:internal/modules/cjs/loader:1080
│ throw err;
│ ^
│
│ Error: Cannot find module '/var/folders/j7/sjfkn72n6w17zd4z7b4b17d80000gq/T/mirrord
│ -bin/Users/some-user-name/.volta/tools/image/npm/9.6.4/bin/npm-cli.js'
│ at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
│ at Module._load (node:internal/modules/cjs/loader:922:27)
│ at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:
│ 81:12)
│ at node:internal/main/run_main_module:23:47 {
│ code: 'MODULE_NOT_FOUND',
│ requireStack: []
│ }
│
│ Node.js v18.17.0
│ command finished with error: command (/Users/some-user-name/some-app
│ ) /Users/some-user-name/.volta/tools/image/npm/9.6.4/bin/npm run dev exited (1)
└────>
┌ web-launcher#dev > cache bypass, force executing **redacted**
│ node:internal/modules/cjs/loader:1080
│ throw err;
│ ^
│
│ Error: Cannot find module '/var/folders/j7/sjfkn72n6w17zd4z7b4b17d80000gq/T/mirrord
│ -bin/Users/some-user-name/.volta/tools/image/npm/9.6.4/bin/npm-cli.js'
│ at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
│ at Module._load (node:internal/modules/cjs/loader:922:27)
│ at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:
│ 81:12)
│ at node:internal/main/run_main_module:23:47 {
│ code: 'MODULE_NOT_FOUND',
│ requireStack: []
│ }
│
│ Node.js v18.17.0
from mirrord.
I think I found the problem:
argv:
["/Users/aviramhassan/.volta/tools/image/node/18.17.0/bin/node","/var/folders/2h/fn_s1t8n0cqfc9x71yq845m40000gn/T/mirrord-bin/Users/aviramhassan/.volta/tools/image/node/18.17.0/bin/npm","run","dev"]
which means node loads the npm script from the tmpbin then tries to find stuff in relation to it
from mirrord.
ok. I found the issue. We don't get loaded - how I found out - I edited the sip patch npm
file it's erroring about to print proces.env
and saw that it's quite empty - turbo launches a new node, not inheriting any of the env to it, including DYLD!!!
AHHHHHhh
from mirrord.
Nice. We could try changing the execve hook to add DYLD_INSERT_LIBRARIES to the env if not there, right?
from mirrord.
Yup, on it.
from mirrord.
We really don't like the env stripping - the argv stripping doesn't work - because $TMPDIR
isn't set, then it tries to strip another path.
I'm changing the logic of SIP to just identify mirrord-bin-RANDOM
- adding a random prefix (that is hardcoded) so we'll just identify based on mirrord-bin-RANDOM
.
geeeeee
from mirrord.
Probably same issue but on Linux https://discord.com/channels/933706914808889356/950020257156833340/1276641706078372021
from mirrord.
Reproduced with this example
from mirrord.
I've wasted so much time, should've done it as the first step:
razz4780@razz4780-machine:~/MetalBear/mirrord-sip-npm-issue$ file /home/razz4780/MetalBear/mirrord-sip-npm-issue/node_modules/turbo-linux-64/bin/turbo
/home/razz4780/MetalBear/mirrord-sip-npm-issue/node_modules/turbo-linux-64/bin/turbo: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=53079539de775c245d18ee32c9754ccb04c8b1f8, stripped
;___;
from mirrord.
oh no :O
from mirrord.
maybe there's out of the box feature for turbo to passing env? it's a bit weird it strips everything :|
from mirrord.
Ok, I managed to make it work. This has to merged into turbo.json
:
{
"globalPassThroughEnv": ["MIRRORD_*", "LD_PRELOAD"]
}
from mirrord.
perhaps add
DYLD_INSERT_LIBRARIES
as well? and add to mirrord.dev?
from mirrord.
Related Issues (20)
- SQS E2E tests
- Always resolve our host
- compat issue old operator new mirrord HOT 2
- Add test for copy target + scaledown
- `outgoing_tcp` integration test is flakey
- Golang 1.23 mirrord steal stopped working HOT 1
- Use agent limit in `mirrord port-forward` and `mirrord vpn`
- Support using a ConfigMap as a source for a Queue Name for SQS queue splitting
- Support specifying both header and path filter for stealing HTTP HOT 7
- Analytics duration is inaccurate HOT 1
- `mirrord container -- docker run -it --rm alpine` fails with `stdout and stderr were empty`
- Show warning when local app subscribes to a remote port that is not defined on the target container
- Use JSON args in mirrord-agent dockerfile HOT 1
- "Operator not found" message shown even if operator is set to false HOT 6
- Support DNS resolution in port-forward command
- Mirrord fails to connect with Proxy error, connectivity issue or bug HOT 4
- Write a message about mfT when users are unable to create agent because of permissions HOT 1
- Write a message about mfT when user uses HTTP filter HOT 2
- Add attribution to redirections to mfT HOT 2
- Deprecate OperatorApi::list_targets
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mirrord.