IamKingWaiMark / FBP

Firebase Plugin for Unreal Engine
2 stars 0 forks source link

5.2.1 The plugin stopped working and crashes. 0xC000001D: Illegal Instruction. UnrealEditor-FBP.dll #8

Open DimZakir1 opened 6 months ago

DimZakir1 commented 6 months ago

Hello, I wrote a question on the plugin page in the UE store, and I also decided to duplicate it here.

I just recently bought the plugin a couple of days ago and everything worked great.

Checked authentication, Firestore requests and Firestore listening.

But at one point, when testing Firestore requests and launching a game in the project, UE5 simply crashed and closed. Now queries and listening don't work.

The plugin worked well for two days and stopped working today. UE5 simply crashes when the game starts if the Request or listen should be done in "EventBeginPlay", or "EventConstruct". And if you put the Firestore request launch on the button, then the game will start and when you press the button, both the game and UE5 will launch.

Authentication still works fine, for some reason only queries and database listening stopped working.

Do you have a working solution on how to get everything back?

In the VS Code log I saw such an error just before the fall of UE5, and only when calling any functions from your plugin, except authentication

[2023-12-12T02:22:52.754Z]LogJson: Warning: Field firebase_url was not found.

[2023-12-12T02:22:52.754Z]LogJson: Error: Json Value of type 'Null' used as a 'String'.

An exception was thrown at 0x00007FFBB5AEC2CD (UnrealEditor-FBP.dll) in UnrealEditor.exe: 0xC000001D: Illegal Instruction.

Unhandled exception at 0x00007FFBB5AEC2CD (UnrealEditor-FBP.dll) in UnrealEditor.exe: 0xC000001D: Illegal Instruction.

DimZakir1 commented 6 months ago

I checked Cloud Storage - Download File, it also works fine, the files are downloaded.

Adding or editing documents also does not work.

Problems only with Firestore DataBase, with recording, listening, adding, editing.

The project was rebuilt, new empty projects were created, and the UE files were checked. Everything is fine with the database, it has been working fine for a year now, but in other applications.

The error remains, I ask you for help, I no longer know what the problem could be. The most interesting thing is that the plugin worked at first, I made about 10-15 test queries and database listens.

DimZakir1 commented 6 months ago

New data: The error is not related to the crash of the UE5 engine "[2023-12-12T02:22:52.754Z]LogJson: Warning: Field firebase_url was not found.

[2023-12-12T02:22:52.754Z]LogJson: Error: Json Value of type 'Null' used as a 'String'."

I just don't have a real time database. I created it just in case and replaced Json.

But unfortunately UE5 continues to crash when querying, reading, deleting, listening, etc. on the Firestore database and crashes with an error in VS

"An exception was thrown at 0x00007FFBB5AEC2CD (UnrealEditor-FBP.dll) in UnrealEditor.exe: 0xC000001D: Illegal Instruction.

Unhandled exception at 0x00007FFBB5AEC2CD (UnrealEditor-FBP.dll) in UnrealEditor.exe: 0xC000001D: Illegal Instruction."

DimZakir1 commented 6 months ago

So the error is not related to json. The Firebase_Url that it is looking for turns out to be associated with a real-time database that I do not use. I don’t know why not check this in code. I created a realtime database and replaced google-services.json just in case. Now there is no error related to Json. But UE5 continues to crash with an error after running the Firestore database access function “An exception was thrown at 0x00007FFBB5AEC2CD (UnrealEditor-FBP.dll) in UnrealEditor.exe: 0xC000001D: Illegal Instruction.”

The error occurs in all functions accessing the database, writing, deleting, reading, listening.

For example: Here is a piece of code that starts to be executed to access the database and request document ()

`void UFBPFirestore::FBPGetDocument(const TArray DocumentPath, const FOnDocumentRetrieved& OnDocumentRetrieved, const FOnFailToRetrieveDocument& OnFailToRetrieveDocument) {

if PLATFORM_WINDOWS || PLATFORM_ANDROID || PLATFORM_IOS || PLATFORM_MAC

bool isDocumentPath = UFBPFirestoreUtilities::FBPIsDocumentReference(DocumentPath);
if(!isDocumentPath)
{
    OnFailToRetrieveDocument.ExecuteIfBound("Path is not pointing to a document.");
    return;
}
const firebase::firestore::Firestore *Firestore = UFBPFirestore::FBPGetFirestore();
if(UFBPFileUtilities::HasGoogleFile)
{
    firebase::firestore::DocumentReference FirebaseDocument = UFBPFirestoreUtilities::FBPGetDocumentReference(Firestore, DocumentPath);
    FirebaseDocument.Get().OnCompletion(
        [FirebaseDocument, OnDocumentRetrieved, OnFailToRetrieveDocument](const firebase::Future<firebase::firestore::DocumentSnapshot>& Result)
        {
            if(Result.error())
            {
                OnFailToRetrieveDocument.ExecuteIfBound(FString(Result.error_message()));
            }
            else
            {
                FDocumentSnapshot DocumentSnapshot = FDocumentSnapshot();
                const FString DocumentId = FString(FirebaseDocument.id().c_str());
                DocumentSnapshot.Id = DocumentId;
                DocumentSnapshot.Data = UFBPFirestoreUtilities::FBPGenerateDocumentMap(Result.result()->GetData());
                OnDocumentRetrieved.ExecuteIfBound(DocumentId, DocumentSnapshot);
            }
        });
}
#else
    GEngine->AddOnScreenDebugMessage(-1, 30.f, FColor::Red, TEXT("[FBP] Firestore is not available for the current OS you are using. See documentation for more info."));
#endif

}`

Unless we provide the document path through the standard UE “Make Array” function. then everything ends well and the program does not crash. code stop here

{ OnFailToRetrieveDocument.ExecuteIfBound("Path is not pointing to a document."); return; }

If a path is specified, a breakpoint in VS skips the async code and moves on (I’ve marked with comments where) `firebase::firestore::DocumentReference FirebaseDocument = UFBPFirestoreUtilities::FBPGetDocumentReference(Firestore, DocumentPath); FirebaseDocument.Get().OnCompletion(

breakpoint skip that

[FirebaseDocument, OnDocumentRetrieved, OnFailToRetrieveDocument](const firebase::Future<firebase::firestore::DocumentSnapshot>& Result)
{
    if(Result.error())
    {
        OnFailToRetrieveDocument.ExecuteIfBound(FString(Result.error_message()));
    }
    else
    {
        FDocumentSnapshot DocumentSnapshot = FDocumentSnapshot();
        const FString DocumentId = FString(FirebaseDocument.id().c_str());
        DocumentSnapshot.Id = DocumentId;
        DocumentSnapshot.Data = UFBPFirestoreUtilities::FBPGenerateDocumentMap(Result.result()->GetData());
        OnDocumentRetrieved.ExecuteIfBound(DocumentId, DocumentSnapshot);
    }
});`

In VS in local, we see this Снимоdgк экрана 2023-12-16 023004

Next, there is a transition to another file and only the line from the code I marked is executed

`DEFINE_FUNCTION(UFBPFirestore::execFBPGetDocument) is executed { P_GET_TARRAY(FString,Z_Param_DocumentPath); P_GET_PROPERTY_REF(FDelegateProperty,Z_Param_Out_OnDocumentRetrieved); P_GET_PROPERTY_REF(FDelegateProperty,Z_Param_Out_OnFailToRetrieveDocument); P_FINISH; P_NATIVE_BEGIN;

Run that line

UFBPFirestore::FBPGetDocument(Z_Param_DocumentPath,FOnDocumentRetrieved(Z_Param_Out_OnDocumentRetrieved),FOnFailToRetrieveDocument(Z_Param_Out_OnFailToRetrieveDocument)); # P_NATIVE_END; }`

Next, we move for a long time through the ScriptCore.cpp file up and down. Then an error occurs `An exception was thrown at 0x00007FFBB5AEC2CD (UnrealEditor-FBP.dll) in UnrealEditor.exe: 0xC000001D: Illegal Instruction.

Unhandled exception at 0x00007FFBB5AEC2CD (UnrealEditor-FBP.dll) in UnrealEditor.exe: 0xC000001D: Illegal Instruction.`

Error after executing the code from the ScriptCore.cpp file right after the line I marked

`if (!bUsePersistentFrame) { // Destroy local variables except function parameters.!! see also UObject::CallFunctionByNameWithArguments // also copy back constructed value parms here so the correct copy is destroyed when the event function returns

UE5 crashes immediately after executing this line for (FProperty*

for (FProperty* P = Function->DestructorLink; P; P = P->DestructorLinkNext)
{
    if (!P->IsInContainer(Function->ParmsSize))
    {
        P->DestroyValue_InContainer(NewStack.Locals);
    }
    else if (!(P->PropertyFlags & CPF_OutParm))
    {
        FMemory::Memcpy(P->ContainerPtrToValuePtr<uint8>(Parms), P->ContainerPtrToValuePtr<uint8>(NewStack.Locals), P->ArrayDim * P->ElementSize);
    }
}

}`