-
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
An established connection was aborted by the software in your host machine #60
Comments
Problem not in Content-Length, node.js always return Content-Length, when response.end used (idk why) |
Note: I deleted a couple of comments because my points weren't concise. Clarification and Dirty FixYour trace is from a log message. It is logged before retrying an invocation request: Javascript.NodeJS/src/NodeJS/NodeJSServiceImplementations/OutOfProcess/OutOfProcessNodeJSService.cs Line 296 in 2cd5d66
From the log message, we're retrying because a connection was aborted by NodeJS while the .Net process was sending data to it:
Does the retry succeed? If it fails, an Dirty fix: I'd suggest increasing the number of retries for now ( Possible Causes
Possible Fix (#61)
|
Error occurs 1-2 times per hour. |
Thanks for the extra info. My "possible causes" seem unlikely. Anyway I've released 5.2.1 with 2 changes:
Incidentally, while running benchmarks for
Heads up for the guys cloning |
I'm also getting the "The response ended prematurely." error frequently. Since the errors are also triggered from a web test that always sends the same data to node, I know that it cannot be from a malformed request. Any ideas? |
Hey @aKzenT, could you could provide the full stack trace? Let me know if you have any problems capturing it. |
|
Thanks for the extra details. We'll need a bit more information,
Are you able to add logging to your project? Check out the first comment, it includes this library's log output, which lists retry count and the hierarchy of inner exceptions and their log messages. Also is it possible for you to reproduce the issue in a public repository? |
This is the log output from the library:
I don't think I can reproduce this in a pulic repository. It is worth noticing that this affects about on in a thousand calls. |
Did some reading up on the .Net side. Found an identical issue: dotnet/runtime#31528. Also took a look at the code throwing the Noticed that Short-term, I suggest increasing retries to 3: OutOfProcessNodeJSServiceOptions.NumRetries. |
This call stack seems to be very similar to what you get if the node process dies for some reason, e.g.
which can be easily reproduced by running the node process out of ram using a combination of: let bigThing = {}
for (let i = 0; i < 1024000; ++i) {
bigThing[`prop${i}1`] = "a".repeat(1024 * 1024);
} and services.Configure<NodeJSProcessOptions>(
options => options.NodeAndV8Options = "--max-old-space-size=512"); // 512Mb When this happens node produces detailed diagnostic messages, but these are lost making it difficult to know what actually went wrong. I think collating the messages from node's stderr/stdout would likely help diagnose the issues above. |
6.0.0-beta.2 now uses HTTP/2 which should mitigate connection issues. It also exposes a new option, Lines 27 to 39 in b96c2f9
|
Sometime we got that error
I suppose that happen because Content-Length is not setted here and HttpClient and node-js works in chunked mode
https://github.com/dotnet/corefx/blob/master/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ChunkedEncodingReadStream.cs
and
https://github.com/dotnet/corefx/blob/master/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ContentLengthReadStream.cs
by documentation here
For set
res.setHeader('Content-Length', Buffer.byteLength(responseJson));
and for string case too
Also thats can be increase performance for nodejs and HttpClient, need benchmarks :)
The text was updated successfully, but these errors were encountered: