-
Notifications
You must be signed in to change notification settings - Fork 42
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
ConnectionException: Process with ID 83312 exited before connecting. #186
Comments
I think the real error is "The command line is too long." which is printed before the process exits (or never even starts). Since the library passes an internal script on the command line, the command line will be quite long already, maybe on your system it gets too long What OS are you running on? Is the path name to your application and to the node executable very long? |
Hiya, thanks for the reply - I'm on Windows 11 and the project isn't nested very deep: But it works fine with 6.3.1, as soon as I upgrade to version 7 thats when the error occurs |
I am on MacOS and I am also experiencing this. Tested both static and DI-approach, which not surprisingly, fails in the same way. |
@CallumVass what about the path to the node executable? @ZeldaIV do you also see the "command line too long" error in the log output? |
@aKzenT Likewise, my node executable isn't very deep either: |
Something happened between 7.0.0-beta.4 and 7.0.0-beta.5 which is causing the issue. It works all the way up to installing beta 5, then I get that error. If I go back to beta 4 it works fine. |
@CallumVass Thanks for the details. We did make changes from beta 4 to 5 that affected script length:
PR: #173 We need to check how the length of the script changed after these changes. If it got longer we should shorten it to no longer than before, perhaps more aggressive minification with Vite (if possible) or manual code simplification. @aKzenT would you like to handle this issue? |
In beta 4 we were passing the configuration to the webpack script. Webpack was automatically minifying when mode was "release": Javascript.NodeJS/src/NodeJS/Jering.Javascript.NodeJS.csproj Lines 100 to 101 in 41f70f4
Javascript.NodeJS/src/NodeJS/Javascript/webpack.config.js Lines 1 to 27 in 41f70f4
In beta 5 we are no longer minifying: Javascript.NodeJS/src/NodeJS/Jering.Javascript.NodeJS.csproj Lines 99 to 100 in 5999180
Javascript.NodeJS/src/NodeJS/Javascript/vite.config.ts Lines 1 to 8 in 5999180
I've verified that: import { defineConfig } from "vite";
export default defineConfig({
build: {
minify: true,
emptyOutDir: false,
ssr: true,
},
}); as suggested by @CallumVass minifies adequately:
We just need to pass the configuration to vite.config. I'm not familiar with Vite though, @CallumVass would you like to create a pull request with the necessary changes? |
I've minified it locally using
Looking at the generated script, it doesnt match what is being passed above, the last few characters: +`\0 |
Odd that it is getting truncated. After changing minify to true, how are you running it locally? Could you try running the test suite? It passes on my windows 11 machine with minify set to true. |
@JeremyTCD - Yeah I get the same error in tests, using Windows 11 also:
Its the same as above, the script seems truncated. It looks like vite isnt minifying across a single line like the webpack one was doing and that is causing an issue somewhere |
The library escapes the script before starting the node process: Javascript.NodeJS/src/NodeJS/NodeJSServiceImplementations/OutOfProcess/NodeJSProcessFactory.cs Lines 105 to 158 in 5999180
This is where the process start info is created: Javascript.NodeJS/src/NodeJS/NodeJSServiceImplementations/OutOfProcess/NodeJSProcessFactory.cs Lines 49 to 59 in 5999180
Could you place breakpoints and take a closer look at I can't reproduce the issue on my machine so it's definitely a system-specific problem: 2023-12-03.17-23-00.mp4 |
This is what is passed as arguments to the process via startInfo:
It looks like its going over multiple lines so I suspect thats the issue? The |
Yes it looks like line endings are the issue. Managed to repro with the script you pasted:
When you open Http11Server.js, are your line endings crlf or lf? |
@CallumVass good catch, I've checked on my machine, the script you pasted has "\r\r\n" line endings. The original (pre-Vite minification) line: Javascript.NodeJS/src/NodeJS/Javascript/Servers/OutOfProcess/Http/Http11Server.ts Line 211 in 5999180
Not sure what is causing "\r\n"s to become "\r\r\n"s. I can't look too deeply into this right now, but at first glance I think we can just remove the carriage return characters from that string literal. |
No it just throws |
|
Remove the "\r"s and run the tests |
Its still not working, the |
It works fine on my machine even though it's not on a single line. It's some other problem. If it's not the extra '\r's, I'm not sure what it is. Can you try Node 20.10.0? |
To add to @JeremyTCD comment, some programs like Visual Studio like to install their own node versions, which might have precedence over the installed version. The library has an option to specify the path to the executable. You could try to set that to your installed Node 20 version just to make sure it is executing the correct one. |
Thanks guys for your help but I'm unable to resolve it, the version of Node I'm using is 20.5.1 as seen by one of the errors above. I've decided to implement my own hosted node server within my .NET app to perform my JS function instead which is working fine, feel free to close this. |
I noticed that in the script you pasted, the line actually ends with \0 which in Windows often indicates the end of a string. So I suspsect that this is the real problem rather than the new lines. @JeremyTCD do you also have the \0 present locally? |
@CallumVass apologies on not having a solution.
@aKzenT Yes I do. In the script the \0 is used to demarcate the end of log
messages. Agree that it's suspicious his script ends there.
…On Mon, 4 Dec 2023, 17:53 aKzenT, ***@***.***> wrote:
@CallumVass <https://github.com/CallumVass>
\0
I noticed that in the script you pasted, the line actually ends with \0
which in Windows often indicates the end of a string. So I suspsect that
this is the real problem rather than the new lines. @JeremyTCD
<https://github.com/JeremyTCD> do you also have the \0 present locally?
—
Reply to this email directly, view it on GitHub
<#186 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACZQXCVFJUOEGU577EHNPULYHWMQ7AVCNFSM6AAAAABABXVOXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZYGE4TENBUGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
No worries, thanks for your help. It looks like a great library but unfortunately it wasn't working for me, and my need is quite simple so it wasn't too difficult to implement, thanks again. |
@JeremyTCD I am not sure if this is the same issue, or if I should open a new issue. I successfully implemented the library, and ran the node command in my dev environment, but after deploying to production I am getting the following error: Process with ID XXXXX exited before connecting. The code invoking the library is: and the code in the file is: I cannot figure out why I can get this to work in dev but not prod. Node version is 20.13.1 |
Hi, I've noticed a pattern. I have nvm for windows, and i have installed node versions (10.16.3, 18.19.0).. then when the current version is (10.16.3) and tries run InvokeFromStringAsync, the error is: Process with ID XXXX exited before connecting. then stop my netcore application and changed to node version 18.19.0 (nvm use 18.19.0) and the script work well. Is it possible to include a node version in my netcore to fix the node version to be used and configure the jering library to use it? |
It is necessary that the machine used in production has node installed, in your case (20.13.1) |
Hi,
I'm trying to use this library but I keep facing this exception when using version 7 of this library, if I downgrade to 6.3.1 it works fine?
For the avoidance of doubt, I can run node just fine from command line so its definitely on my PATH. I am using .NET 8 (I've tried in .NET 6 and 7 too) and Node 20:
Here is my log output from a small repro:
Log:
The text was updated successfully, but these errors were encountered: