getnamo / NodeJs-Unreal

Embed node.js as an Unreal Engine plugin.
MIT License
239 stars 34 forks source link

Crashed by "Assertion failed" with packaged game ".exe" #33

Open hikingyoung opened 2 years ago

hikingyoung commented 2 years ago

After packaged, Every time I quit the game, either BP node "Quit Game" or console command "exit", the game will pop up an error window as below: error

It's not caused by my code or any other logic because I test it with an almost "empty" ue4.26 project and crashed as well. Map: default level. (from file ->new level ->Default) Actor: Basic actor with a node component inside, the component runs a script that has only 1 line js code:

Console.log("hello world")

UE4 level outline

ue4 outline

My js script

my js script

Inside the BP actor

Runs Ok within UE4 editor

After packaged, I run the .exe , then pop up a crash error windows as mentioned firstly above. I think something caused Memory Leak, and I tried to figure it out. After serveral days flew away (I first noticed this on August 3rd), now I know I can never do it. Can you spare some time to help me ? Hope your reply and any help will be highly appreciated. Thank you again. You Sincerely.

Sakikonn commented 2 years ago

@getnamo @hikingyoung In NodeCmd.cpp

void FNodeCmd::StopMainScript()
{
    if (bIsMainRunning)
    {
        /*FCULambdaRunnable::RunLambdaOnBackGroundThread([this]
        {
            StopMainScriptSync();
        });*/

        StopMainScriptSync();
    }
}

I modified it, It might be because of this asynchronous, It doesn't crash now, I don’t know what effect this modification will have But now it will not crash after packaging, I guess it may be caused by the callback. My English is not good, I don’t know if this explanation is correct.