Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug Internal bursted Debug.LogError() makes hard crashes on iOS platform

Discussion in 'Unity Transport' started by Kichang-Kim, Apr 21, 2022.

  1. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    979
    Hi. I found that Unity Transport's burst-compiled Debug.LogError() in UnityTransportProtocol.cs (ex, line 367) makes hard crashes on iOS Platform. Especially, when accessing Unity's API in Application.logMessageReceived handler.

    Here is a part of stack-trace of crash report:
    Native StackTrace:

    Thread 0 (crashed)
    0 libsystem_kernel.dylib 0x00000001bb1d2bbc <symbols missing for uuid: 3d3637098d2d3d1e8cab11d232e5d508>
    1 libsystem_c.dylib 0x000000018b13ca50 <symbols missing for uuid: 0c058d0be8f036aa9766fa72ee100d98>
    2 UnityFramework 0x00000001091cf4d8 DebugStringToFilePostprocessedStacktrace(DebugStringToFileData const&) (/Users/bokken/buildslave/unity/build/Runtime/Core/Containers/String.h:222)
    3 UnityFramework 0x00000001091cf9dc DebugStringToFile(DebugStringToFileData const&) (/Users/bokken/buildslave/unity/build/Runtime/Core/Containers/String.h:222)
    4 UnityFramework 0x00000001089c4b78 burst_abort_optional_longjmp(char const*, char const*, bool, core::basic_string<char, core::StringStorageDefault<char> >) (/Users/bokken/buildslave/unity/build/Runtime/Core/Containers/String.h:222)
    5 UnityFramework 0x00000001089c4ab8 burst_abort(char const*, char const*) (/Users/bokken/buildslave/unity/build/Runtime/Jobs/ScriptBindings/JobsBindings.cpp:576)
    6 UnityFramework 0x0000000108b4b098 scripting_raise_exception(ScriptingExceptionPtr) (/Users/bokken/buildslave/unity/build/Runtime/Scripting/ScriptingException.cpp:36)
    7 UnityFramework 0x0000000108b4b66c CreateUnityExceptionCommonMessage(char const*) (/Users/bokken/buildslave/unity/build/Runtime/Scripting/ScriptingException.cpp:73)
    8 UnityFramework 0x0000000108b4ff7c ThreadAndSerializationSafeCheck::ReportError(int, char const*, ...) (/Users/bokken/buildslave/unity/build/Runtime/Scripting/ScriptingThreadAndSerializationSafeCheck.cpp:97)
    9 UnityFramework 0x0000000108b4ffb0 IManagedObjectHost::ReinterpretCast(Object*) (/Users/bokken/buildslave/unity/build/Runtime/Scripting/ManagedReference/IManagedObjectHost.h:91)
    10 UnityFramework 0x0000000108b4e36c ThreadAndSerializationSafeCheck::ReportError(char const*) (/Users/bokken/buildslave/unity/build/Runtime/Scripting/ScriptingThreadAndSerializationSafeCheck.cpp:200)
    11 UnityFramework 0x00000001088475e0 Time_Get_Custom_PropRealtimeSinceStartupAsDouble() (/Users/bokken/buildslave/unity/build/artifacts/iOS/Modules/iOS_arm64_dev_i_ut_r/Bindings/CoreBindings.gen.cpp:61585)
    12 UnityFramework 0x0000000109a92670 ErrorReportingSystem_LogMessageReceivedCore_m71FC8E1ED729481966884757C05420026783EDC9 (MY-PROJECT-PATH/xcode/Classes/Native/Assembly-CSharp11.cpp:0)
    13 UnityFramework 0x0000000109a93c1c U3CLogMessageReceivedOnMainThreadU3Ed__13_MoveNext_mF6F8EB3C573A9A52AE65A34C5DC8929A7FA259AA (MY-PROJECT-PATH/xcode/Classes/Native/Assembly-CSharp11.cpp:16012)
    14 UnityFramework 0x0000000109a924e4 ErrorReportingSystem_LogMessageReceivedOnMainThread_m56DD32DBABCF3A1678C3B4CA1CDA01AA1667B6E3 (MY-PROJECT-PATH/xcode/Classes/Native/Assembly-CSharp11.cpp:14762)
    15 UnityFramework 0x0000000109a923e0 ErrorReportingSystem_LogMessageReceived_mBF87D66F9B2FB79CBECC4529C98A506FE837A25D (MY-PROJECT-PATH/xcode/Classes/Native/Assembly-CSharp11.cpp:14706)
    16 UnityFramework 0x0000000108773838 LogCallback_Invoke_m88EACBF170351AE6FC8E6F5154CD09179D67BB47_Multicast(LogCallback_tCFFF3C009186124A6A83A1E6BB7E360C5674C413*, String_t*, String_t*, int, MethodInfo const*) (MY-PROJECT-PATH/xcode/Classes/Native/UnityEngine.CoreModule.cpp:14484)
    17 UnityFramework 0x00000001098139f4 il2cpp::vm::Runtime::InvokeWithThrow(MethodInfo const*, void*, void**) (/Users/bokken/buildslave/unity/build/External/il2cpp/builds/libil2cpp/vm/Runtime.cpp:0)
    18 UnityFramework 0x000000010981383c il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**) (/Users/bokken/buildslave/unity/build/External/il2cpp/builds/libil2cpp/vm/Runtime.cpp:570)
    19 UnityFramework 0x0000000108b3d724 scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool) (/Users/bokken/buildslave/unity/build/Runtime/ScriptingBackend/Il2Cpp/ScriptingApi_Il2Cpp.cpp:292)
    20 UnityFramework 0x0000000108b4c4a4 ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool) (/Users/bokken/buildslave/unity/build/Runtime/Scripting/ScriptingInvocation.cpp:0)
    21 UnityFramework 0x0000000108b1c778 Application_Bindings::LogCallbackImplementation(DebugStringToFileData const&, LogType, bool) (/Users/bokken/buildslave/unity/build/Runtime/ScriptingBackend/ScriptingNativeTypes.h:65)
    22 UnityFramework 0x00000001091cf634 CallbackArray3<DebugStringToFileData const&, LogType, bool>::Invoke(DebugStringToFileData const&, LogType, bool) (/Users/bokken/buildslave/unity/build/Runtime/Core/Callbacks/CallbackArray.h:405)
    23 UnityFramework 0x00000001091cf12c DebugStringToFilePostprocessedStacktrace(DebugStringToFileData const&) (/Users/bokken/buildslave/unity/build/Runtime/Logging/LogAssert.cpp:893)
    24 UnityFramework 0x00000001091cf9dc DebugStringToFile(DebugStringToFileData const&) (/Users/bokken/buildslave/unity/build/Runtime/Core/Containers/String.h:222)
    25 UnityFramework 0x00000001088fc4c4 DefaultBurstLogCallback(void*, BurstLogType, char const*, char const*, int) (/Users/bokken/buildslave/unity/build/Runtime/Burst/Burst.cpp:1217)
    26 UnityFramework 0x0000000109907454 ac437fae5438a84f5acb46d9379b0a3c (MY-PROJECT-PATH/Library/PackageCache/com.unity.transport@1.0.0-pre.16/Runtime/UnityTransportProtocol.cs:370)
    27 UnityFramework 0x00000001089c5bdc ExecuteJob(ManagedJobData*, void (*)(void*, void*, void*, void*, int), int, unsigned char*) (/Users/bokken/buildslave/unity/build/Runtime/Jobs/ScriptBindings/JobsBindings.cpp:1131)
    28 UnityFramework 0x00000001089c5188 ForwardJobToManaged(ManagedJobData*) (/Users/bokken/buildslave/unity/build/Runtime/Jobs/ScriptBindings/JobsBindings.cpp:1410)
    29 UnityFramework 0x00000001089c21b4 JobQueue::Exec(JobInfo*, long long, int, bool) (/Users/bokken/buildslave/unity/build/Runtime/Jobs/Internal/JobQueue.cpp:0)
    30 UnityFramework 0x00000001089c372c JobQueue::WaitForJobGroupID(JobGroupID, JobQueue::JobQueueWorkStealMode) (/Users/bokken/buildslave/unity/build/Runtime/Jobs/Internal/JobQueue.cpp:0)
    31 UnityFramework 0x00000001089be81c CompleteFenceInternal(JobFence&, WorkStealMode) (/Users/bokken/buildslave/unity/build/Runtime/Jobs/Jobs.cpp:17)
    32 UnityFramework 0x0000000108b0a8bc ScheduleBatchedScriptingJobsAndComplete(JobFence&, ScriptingExceptionPtr*)

    Even it is called from main thread, accessing to Time.realtimeSinceStartupAsDouble makes crashes.

    Similar issue but occurred in Editor is reported as Case 1421406.
    https://forum.unity.com/threads/case-1421406-editor-crashes-when-logging-from-bursted-job.1270262/
     
    mbaker likes this.
  2. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    383
    Thanks for reporting this!

    Your report on the editor crash seems to indicate that this could be a wider issue than just Unity Transport and iOS. There's a chance it could happen on other platforms, it seems. Would that be an accurate statement? If so I'll forward the information to the proper team so they can have a look at this.
     
    Kichang-Kim likes this.
  3. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    979
    Yes, I think this issue affect any other API using Debug.LogXXX in bursted job/method.