Skip to content
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

execSync failed without any message #4518

Open
joy-0909 opened this issue Dec 16, 2024 · 10 comments
Open

execSync failed without any message #4518

joy-0909 opened this issue Dec 16, 2024 · 10 comments

Comments

@joy-0909
Copy link

Version

No response

Platform

linux

Subsystem

No response

What steps will reproduce the bug?

Snipaste_2024-12-16_15-21-18 When I execute an exe program in the close event of an asynchronous task, sometimes the program throws an exception, but I can't get the exception information. I don't know what caused it. Is my process killed?

How often does it reproduce? Is there a required condition?

sometimes

What is the expected behavior? Why is that the expected behavior?

Should be executed successfully, or fail with information

What do you see instead?

throw an error,and the error msg is null

Additional information

No response

@juanarbol
Copy link
Member

Hi, thanks for the report. Could you please provide a minimal repro case?

Without it is very hard to debug.

@joy-0909
Copy link
Author

@juanarbol
and the status is 3221225477
the std out is null
the stderr is null

@gireeshpunathil
Copy link
Member

3221225477 = 0xC0000005 (access violation). If this child runs independently and through a sample code without any issues but only crashes within your asynchronous code, a probable cause is the arguments. is there a way you can log all the input what was passed to the child? another probable cause is the environment variables. is there a way you can log all the env variables available to the child in both the cases?

@joy-0909
Copy link
Author

@gireeshpunathil It can only be reproduced on some people's devices, and it may not appear in different projects, so it is certain that it is not a problem with arguments. As for the environment variables you mentioned, can you explain it in more detail?

@joy-0909
Copy link
Author

3221225477 = 0xC0000005 (access violation). If this child runs independently and through a sample code without any issues but only crashes within your asynchronous code, a probable cause is the arguments. is there a way you can log all the input what was passed to the child? another probable cause is the environment variables. is there a way you can log all the env variables available to the child in both the cases?

It can only be reproduced on some people's devices, and it may not appear in different projects, so it is certain that it is not a problem with arguments. As for the environment variables you mentioned, can you explain it in more detail?

@joy-0909
Copy link
Author

When I have an asynchronous task, A is the main thread A.ts const child=exec("xxx.exe") child.on("close",()=>{ functionA(); }) B.test functionA(){ try{ execSync("xxxxxxxxAnother.exe","args") }catch(err){ err.toString } }

I manually copied the command line into the operating system and it ran successfully and ended correctly, but an exception was thrown in the node child process and there was no information. both err.toString and err.stderr.toString() Sorry, for some reasons I can't provide the source code and the corresponding exe program, this involves some confidential information of our company. But in fact, I just execSynced a program in an asynchronous event. I can't locate the error at present. I would like to ask you for help.

When I have an asynchronous task, A is the main thread
A.ts
const child=exec("xxx.exe")
child.on("close",()=>{
functionA();
})
B.test
functionA(){
try{
execSync("xxxxxxxxAnother.exe","args")
}catch(err){
err.toString
}
}

I manually copied the command line into the operating system and it ran successfully and ended correctly, but an exception was thrown in the node child process and there was no information.
both err.toString and err.stderr.toString()
Sorry, for some reasons I can't provide the source code and the corresponding exe program, this involves some confidential information of our company. But in fact, I just execSynced a program in an asynchronous event. I can't locate the error at present. I would like to ask you for help.

@gireeshpunathil
Copy link
Member

@gireeshpunathil It can only be reproduced on some people's devices, and it may not appear in different projects, so it is certain that it is not a problem with arguments. As for the environment variables you mentioned, can you explain it in more detail?

you can print with console.log(process.env) in the parent just before execSync in both passing and failing cases to see if there is a difference. and if so, that may give a clue on the failure

@joy-0909
Copy link
Author

@gireeshpunathil It can only be reproduced on some people's devices, and it may not appear in different projects, so it is certain that it is not a problem with arguments. As for the environment variables you mentioned, can you explain it in more detail?

you can print with console.log(process.env) in the parent just before execSync in both passing and failing cases to see if there is a difference. and if so, that may give a clue on the failure

It seems that this exe program does not involve some environmental variables. I also compared it and there is no difference.

@gireeshpunathil
Copy link
Member

if the child is identical in both external factors such as command line input and the environment, then the crash reason should be debugged using a dump debugging tool. it is not easy to help on dump diagnostics through this channel. if you are familiar with the process, then try that. or else, refer to this manual: https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/getting-started-with-windbg

@joy-0909
Copy link
Author


if the child is identical in both external factors such as command line input and the environment, then the crash reason should be debugged using a dump debugging tool. it is not easy to help on dump diagnostics through this channel. if you are familiar with the process, then try that. or else, refer to this manual: https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/getting-started-with-windbg

thanks,i will have a try.

@aduh95 aduh95 transferred this issue from nodejs/node Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants