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. Dismiss Notice

Bug Android Ads SDK SDKErrorHandler coroutine error crash

Discussion in 'Unity Ads & User Acquisition' started by TheKeeperOfPie, Aug 25, 2023.

  1. TheKeeperOfPie

    TheKeeperOfPie

    Joined:
    Aug 25, 2023
    Posts:
    2
    This seems to occur during an unknown network error. The SDK tries to catch the unhandled error and send metrics (although I don't even have those enabled), but it fails on a non-null conversion.

    The relevant JavaDoc for the failure is: https://docs.oracle.com/javase/8/docs/api/java/lang/StackTraceElement.html#getFileName--

    It says "or null if this information is unavailable.", so this case is expected and this line should be changed to `className: String?`: https://github.com/Unity-Technologi...a/com/unity3d/services/SDKErrorHandler.kt#L17

    java.lang.RuntimeException: Exception while trying to handle coroutine exception
    at kotlinx.coroutines.CoroutineExceptionHandlerKt.handlerException(Unknown Source:7)
    at kotlinx.coroutines.CoroutineExceptionHandlerKt.handleCoroutineException(Unknown Source:20)
    at kotlinx.coroutines.StandaloneCoroutine.handleJobException(Unknown Source:4)
    at kotlinx.coroutines.JobSupport.finalizeFinishingState(Unknown Source:59)
    at kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(Unknown Source:130)
    at kotlinx.coroutines.JobSupport.tryMakeCompleting(Unknown Source:41)
    at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(Unknown Source:4)
    at kotlinx.coroutines.AbstractCoroutine.resumeWith(Unknown Source:6)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:43)
    at kotlinx.coroutines.UndispatchedCoroutine.afterResume(Unknown Source:55)
    at kotlinx.coroutines.AbstractCoroutine.resumeWith(Unknown Source:15)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:43)
    at kotlinx.coroutines.UndispatchedCoroutine.afterResume(Unknown Source:55)
    at kotlinx.coroutines.AbstractCoroutine.resumeWith(Unknown Source:15)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:43)
    at kotlinx.coroutines.UndispatchedCoroutine.afterResume(Unknown Source:55)
    at kotlinx.coroutines.AbstractCoroutine.resumeWith(Unknown Source:15)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:43)
    at kotlinx.coroutines.UndispatchedCoroutine.afterResume(Unknown Source:55)
    at kotlinx.coroutines.AbstractCoroutine.resumeWith(Unknown Source:15)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:43)
    at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Unknown Source:6)
    at kotlinx.coroutines.AbstractCoroutine.resumeWith(Unknown Source:15)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:43)
    at kotlinx.coroutines.DispatchedTask.run(Unknown Source:106)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(Unknown Source:0)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(Unknown Source:14)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(Unknown Source:28)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(Unknown Source:0)
    Suppressed: InitializationException(errorState=NetworkConfigRequest, originalException=java.lang.Exception: No connected events within the timeout!, config=com.unity3d.services.core.configuration.Configuration@718d2d)
    at com.unity3d.services.core.domain.task.InitializeStateConfigWithLoader$doWork$2.invokeSuspend(Unknown Source:432)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:11)
    ... 11 more
    Caused by: java.lang.Exception: No connected events within the timeout!
    at com.unity3d.services.core.domain.task.InitializeStateConfigWithLoader$doWork$2.invokeSuspend(Unknown Source:423)
    ... 12 more
    Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [com.unity3d.services.SDKErrorHandler@9f304b0, StandaloneCoroutine{Cancelling}@806cf29, Dispatchers.Default]
    Caused by: java.lang.NullPointerException: exception.stackTrace[0].fileName must not be null
    at com.unity3d.services.SDKErrorHandler.handleException(Unknown Source:23)
    at kotlinx.coroutines.CoroutineExceptionHandlerKt.handleCoroutineException(Unknown Source:10)
    ... 27 more
     
  2. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    597
    Would you be able to reproduce the crash issue? If so, could you please provide the reproduction steps so we can investigate further?
     
  3. TheKeeperOfPie

    TheKeeperOfPie

    Joined:
    Aug 25, 2023
    Posts:
    2
    I think you can reproduce this by using Pi-hole or similar network-level ad blocking software, but I don't think a reproduction is necessary. I've pointed to a line of code in direct contradiction of the JavaDoc for a platform API.
     
  4. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    597
    Thanks for reporting this, this issue will be fixed in Untiy Ads SDK 4.9.0.
     
  5. bcicanci

    bcicanci

    Joined:
    Mar 3, 2020
    Posts:
    2
    Hello, I'm having this issue in Unity Ads SDK 4.7.1.
    Do you have an update when the Unity Ads SDK 4.9.0 will be released?
    Is there a workaround for this issue or an older version that is safe to use?
     
  6. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    597
    This is not a new issue, older versions also have this issue. The new version is expected to arrive within a few days.
     
  7. bcicanci

    bcicanci

    Joined:
    Mar 3, 2020
    Posts:
    2