Comments (9)
Thanks for the report @Suyashtnt, unfortunately this will take a bit of research and debugging to fix, which I haven't had the time for yet, and I can't make any promises on when I'll be able to get to it.
I no longer use NX, but for the people who do just take your time :)
from cargo.
Thanks for the report @Suyashtnt, unfortunately this will take a bit of research and debugging to fix, which I haven't had the time for yet, and I can't make any promises on when I'll be able to get to it.
from cargo.
@dannymcgee I would like to contribute a fix for this. I have isolated the problem. Would you be willing to accept a pull request?
from cargo.
@dannymcgee I made a PR fixing this.
from cargo.
@IgnisDa Thank you so much! I'll try to get this merged in today.
from cargo.
We are currently also running into this issue.
Liked mentioned in #21 the issue is that the output of cargo metadata is too large, it overflowed the buffer
.
A minimal viable patch which works locally is taking this line maxBuffer: 50 * 1024 * 1024,
and adding it to the execSync
call:
let metadata = cp.execSync("cargo metadata --format-version=1", {
encoding: "utf8",
maxBuffer: 50 * 1024 * 1024,
});
Another approach would be the usage of child_process.spawn
.
See https://stackoverflow.com/a/68958420
from cargo.
@robi-wan I forked this repo and published the correct fix here: https://github.com/IgnisDa/npm-libs/tree/main/packages/nx-rust.
The solution you have posted will work but only for metadata below 50mb. For big projects, it would be more than that. It needs to be implemented using json streaming.
from cargo.
@IgnisDa Thank you for this info - a possible workaround for us would be to use your fork with that fix.
My understanding of Nodejs code is not very good but regarding my understanding the root cause for this issue is the limited buffer used in child_process.execSync
: the default buffer size for stdout is 1024 * 1024
(see https://github.com/nodejs/node/blob/91ca2d40419244a9c542be5ff162a837fcc3be82/lib/child_process.js#L95).
It even is the default when using child_process.spawnSync
without changes in handling I/O to the spawned process.
(In your fix you also used child_process.execSync
with an extended buffer of 50 MB - so as I understand it your solution would also fail for big projects?)
You are right: streaming is the right approach but it should not just be used for JSON parsing. It should also be used for fetching the process output - I think therefore instead of child_process.execSync
child_process.spawnSync
should be used and something has to be done to redirect the stdout of cargo metadata --format-version=1
into a resizable buffer or a stream.
from cargo.
@robi-wan Indeed I have increased the buffer size, but then later I have also parsed the json via streaming. You can see them here https://github.com/IgnisDa/npm-libs/blob/main/packages/nx-rust/src/graph/index.ts#L23-L37.
I think therefore instead of child_process.execSync child_process.spawnSync should be used and something has to be done to redirect the stdout of cargo metadata --format-version=1 into a resizable buffer or a stream.
I am not sure about this. I will try to test this theory once I have time.
from cargo.
Related Issues (20)
- Warning from NX when running build, test, or lint command HOT 5
- Add support for Zola HOT 4
- cargo.exe popup window on save (windows) HOT 1
- Project name in nx configuration file HOT 3
- target option for build seems to be ignored / not implemented HOT 4
- Local dependencies for publishable crates HOT 2
- Support for affected dependent builds? HOT 1
- TypeError: builder.addDependency is not a function HOT 1
- [bug] Cannot build when the crate and bin name differ
- Plugin defines cargo dependencies to be implicit dependencies HOT 4
- Default project configuration for libraries doesn't include build configuration
- project future and wasm support HOT 2
- NX build command does not recreate cached target folder. HOT 1
- [Bug Report] target handling in 0.4.0 introduces error with --configuration HOT 2
- Thank you for the plugin! Any roadmap? HOT 2
- Cannot build app HOT 6
- Not an issue but big thanks. HOT 1
- Add Tauri as part of option HOT 1
- Rust - w.a.s.m. support HOT 2
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 cargo.