hmenyus / node-calls-python

Call Python from NodeJS directly in-process without spawning processes
MIT License
252 stars 26 forks source link

run error without any error info in gramine-sgx #38

Closed mccoysc closed 2 years ago

mccoysc commented 2 years ago

the module work well in linux,but get crashed without any error info in gramine-sgx when loaded.

i found a debug info via gramine-sgx which said that "memory access error at address 0.

and also,i can run python by spawn("python").so the error must be caused by node-calls-python.

mccoysc commented 2 years ago

and also,in normal nodejs env,if i call some times,it also throw an error "SIGSEGV" and killed. it seems that you have some memory error in code.

mccoysc commented 2 years ago

my code just like this:

//only call this once. py=new interpreter()// i just export your class,not the instance of your class.

//may call many times: pymodule=py.importSync("someMod") pymodule.execSync(pymodule,params) pymodule.evalSync(pymodule,parms)

at some time,the code cause nodejs crashed with SIGSEGV

mccoysc commented 2 years ago

i found that some time it crashed at evalSync with py code "data" and really,data is not defined in py file.

but,it don't crash every time,just "some time".

hmenyus commented 2 years ago

Please attach a reproducable standalone example. What are your OS and node versions?

mccoysc commented 2 years ago

Please attach a reproducable standalone example. What are your OS and node versions?

any code that run nodejs and require node-calls-python in gramine-sgx would repruduce the error. about gramine-sgx: https://github.com/gramineproject/gramine

mccoysc commented 2 years ago

image

image

mccoysc commented 2 years ago

i add some logs to your cpp code,and this is the logs: image image

mccoysc commented 2 years ago

@hmenyus

mccoysc commented 2 years ago

and more: if you create a worker,in the worker you require node-calls-python. and call some api like importSync("import tensorflow") and execSync. and then terminate the worker.

and loop the above,maybe the node-calls-python would crash node process some time.

hmenyus commented 2 years ago

I cannot reproduce your problem with workers.

Regarding gramine: I do not have time to help you with this. Ubuntu, windows, mac work fine.

In the meantime I have added some improvements to some edge-cases in 1.7.5. Hopefully that will help you.