Repository navigation
Axios causes node.exe to crash without possibility to catch the exception #36325
Description
Activity
"crash" here could mean several things. We need a bit more information. Is an error stack trace generated? Is it a seg fault?
@jasnell , in my example code node.exe just unexpectedly stops working. Without any messages. Without anything that I'm able to detect. I have checked Windows logs, but there is also nothing.
Is it a seg fault?
Sorry, I don't know what it is. Can you suggest some additional tools/configurations to check it?
Immediately after it crashes, enter
echo %errorlevel%on the command line and comment here with what it prints.For details... a "segmentation fault" is a memory error, they occur at the native (c/c++) level of Node.js where there is a bug in Node.js itself. On Linux, when a segfault happens, the operating system is pretty good at telling us about it but on windows it mostly manifests as a "silent crash" --- that is, the Node.js process just exits without any apparent reason.
@jasnell , thanks for explanations!
Regardingecho %errorlevel%- I should have guessed it myself, sorry :-) I have added it to the test, and run. Waiting for result...Reacted by James M Snell and Alex Yang@jasnell , just got the crash: %errorlevel% = 0
Node.js v.14.15.1, after hundreds of requests, several gigabytes of pulled data, on quite unstable and slow internet connection. Not sure that quality of connection pays any role here, but at least it allows to not load heavily my testing REST APIs too much - they are unaware of their privilege to take part in this great testing :·)))- addedhttpIssues and PRs related to the http subsystem.Issues and PRs related to the http subsystem.
on Dec 6, 2020 An error code of 0 means Node.js thinks the execution was successful, and that's also the default code when you call
process.exit(). My guess is your catch handler is causing that:.catch(err => {console.error("ERROR: "+err.message);process.exit()}). Could specify a non-zero error code there please (such asprocess.exit(-1))?Also, please add a catcher to the test call just in case:
test().catch(console.error);.I believe I have the same issue.
node.exe process terminates without any trace.
node.js v12.20.0
axios v0.21.0
Exit code: -1073740791 (0xc0000409)This never happened until axios was updated (from v0.19.2).
Reacted by JellyWang@aduh95, thanks for suggestions, I did as you recommended, but result is still the same: silent termination of node.exe, with %errorlevel% = 0.
As I wrote before - only Basic Auth-protected APIs causes this effect. I have tried to do the "fake" Basic Auth for the public APIs. Unfortunately this trick doesn't work. The problem requires true Basic Auth.
If anyone can share Basic Auth-protected APIs available for the testing - I can try to run test with it.@pavelseverov do you see anything printed to stderr?
@aduh95 when the "silent crashing" occurs neither is printed to STDERR nor to STDOUT
This issue is still happening with 14.16, no error can be found, except:
Error: socket hang up at connResetException (internal/errors.js:607:14) at Socket.socketCloseListener (_http_client.js:443:25) at /usr/src/app/node_modules/dd-trace/packages/dd-trace/src/scope/base.js:54:19 at Scope._activate (/usr/src/app/node_modules/dd-trace/packages/dd-trace/src/scope/async_resource.js:47:14) at Scope.activate (/usr/src/app/node_modules/dd-trace/packages/dd-trace/src/scope/base.js:12:19) at Socket.bound (/usr/src/app/node_modules/dd-trace/packages/dd-trace/src/scope/base.js:53:20) at Socket.emit (events.js:327:22) at Socket.EventEmitter.emit (domain.js:467:12) at TCP.<anonymous> (net.js:673:12) at TCP.callbackTrampoline (internal/async_hooks.js:131:14)Reacted by William Comnisky, Pete Davids and SalviaI have the same issue after axios.get around 500 to 700 urls. I am using Mac, node 14.12, axios 0.21.1.
I tried to catch the error with
process.on('unhandledRejection', (reason, promise) => {
console.log(reason)
})
process.on('uncaughtException', (reason) => {
console.log(reason)
})
process.on('SIGTERM', signal => {
console.log(Process ${process.pid} received a SIGTERM signal)
process.exit(0)
})process.on('SIGINT', signal => { console.log(`Process ${process.pid} has been interrupted`) process.exit(0) })but nothing printed
Reacted by Jaewook AhnSeem to be hitting this issue as well. Exit code 0, only triggered in an arm64 container on AWS, non-deterministic.
I have same issue with @bloodchen. I wrote exactly same catch code but nothing happend. I'm working on Intel mac and Node.js 14.18.2, axios 0.24.0
I want to add, in my case it's not related to basic auth. I just did several hundreds normal http get requests and it crashed at around 400-700 calls.
- Maximum recursion?…------- Original Message -------On Friday, January 21st, 2022 at 1:33 AM, bloodchen ***@***.***> wrote: I want to add, in my case it's not related to basic auth. I just did several hundreds normal http get requests and it crashed at around 400-700 calls. — Reply to this email directly, [view it on GitHub](#36325 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ASZXOGRD3ZRLLTM2CNFKHX3UXCSU7ANCNFSM4UHUIQJQ). Triage notifications on the go with GitHub Mobile for [iOS](https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675) or [Android](https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub). You are receiving this because you commented.Message ID: ***@***.***>
This issue has been stale for long time and it references old versions of both Node.js and axios. With this in mind I'm going to close this issue. Feel free to reopen it or open a new one if you experience the same issue agaion.
What steps will reproduce the bug?
Axios v.0.21.0 Basic Auth GET-queries causes node.exe to silently crash, without possibility to catch the exception.
Occurs with node.js v.14.15.1 (current LTS Version), and earlier versions. Later versions (e.g. v.15.1.0) works Ok
How often does it reproduce? Is there a required condition?
Effect is not stable. Occurs on continuous testing. With more or less normal internet connection node.exe crashes within getting of about one or two gigabytes of data (in summary, by portions, not at once). Choosing bad internet connection will bring the same result faster.
I have reproduced this issue at two different independent REST APIs with Basic Auth. Unfortunately I can't share them, because they are private resources. But I can check some other REST API, if someone can share with me Basic Auth-protected one, available for tests.
I have also tried dozens of APIs from https://github.com/public-apis/public-apis. [Un]fortunately they all work fine, I'm not able to reproduce the issue on them. Probably because there are no Basic Auth-protected APIs.
What is the expected behavior?
Running the above code leads to crash of node.exe without possibility to catch the exception.
UPDATE: with %errorlevel%=0
What do you see instead?
N/A
Additional information
Issue has been also reported to Axios developers: axios/axios#3396
(no solution so far)