Some users are getting onError event with "Detaching surface timed out."

We are working with Sentry crash report tool, since yesterday in an update we made with the Bitmovin android SDK version: 3.23.0 we are noticing some users getting onErrorCallback with the message:

Detaching surface timed out.

Here is the message on Sentry console.

What could be happen?
Thanks in advance.

Hi @gledezma ,

Thanks for asking your query here. In general OnErrorCallback is fired by Bitmovin player SDK when a playback error occurs. This should not result in an application crash or crash report.

Can you please share the full Stack Trace(there is option to view stack trace in the screenshot you shared) to help us understand the issue further?

Hi Lucky, is not a crash, we are just sending the error to our report console, but we want to know what can be the problem. Here is the stack trace.

at dalvik.system.VMStack.getThreadStackTrace(VMStack.java)
    at java.lang.Thread.getStackTrace(Thread.java:1736)
    at com.riivi.riivi.crashlytics.CrashlyticsSender$Companion.sendSentryMessageExternalServices(CrashlyticsSender.kt:20)
    at com.riivi.riivi.ui.player.PlayerActivityInteractor.sendSentryError(PlayerActivityInteractor.kt:156)
    at com.riivi.riivi.ui.player.PlayerActivityPresenter.sendSentryError(PlayerActivityPresenter.kt:368)
    at com.riivi.riivi.ui.player.PlayerActivity.onErrorCallback(PlayerActivity.kt:1332)
    at com.riivi.riivi.ui.player.PlayerActivity.access$onErrorCallback(PlayerActivity.kt:71)
    at com.riivi.riivi.ui.player.PlayerActivity$setupPlayerListeners$6.invoke(PlayerActivity.kt:983)
    at com.riivi.riivi.ui.player.PlayerActivity$setupPlayerListeners$6.invoke(PlayerActivity.kt:983)
    at com.bitmovin.player.u.b.b(SourceFile:206)
    at com.bitmovin.player.u.d.a(SourceFile:1)
    at com.bitmovin.player.p.a.a(SourceFile:2)
    at com.bitmovin.player.p.a.a(SourceFile:1)
    at com.bitmovin.player.f.a0$e.b(SourceFile:7)
    at com.bitmovin.player.f.a0$e.onPlayerError(SourceFile:10)
    at com.google.android.exoplayer2.ExoPlayerImpl.lambda$updatePlaybackInfo$16(ExoPlayerImpl.java:1902)
    at com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda10.invoke
    at com.google.android.exoplayer2.util.ListenerSet$ListenerHolder.invoke(ListenerSet.java:281)
    at com.google.android.exoplayer2.util.ListenerSet.lambda$queueEvent$0(ListenerSet.java:190)
    at com.google.android.exoplayer2.util.ListenerSet$$ExternalSyntheticLambda1.run
    at com.google.android.exoplayer2.util.ListenerSet.flushEvents(ListenerSet.java:211)
    at com.google.android.exoplayer2.ExoPlayerImpl.updatePlaybackInfo(ExoPlayerImpl.java:1971)
    at com.google.android.exoplayer2.ExoPlayerImpl.handlePlaybackInfo(ExoPlayerImpl.java:1783)
    at com.google.android.exoplayer2.ExoPlayerImpl.lambda$new$1$com-google-android-exoplayer2-ExoPlayerImpl(ExoPlayerImpl.java:306)
    at com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda25.run
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:246)
    at android.app.ActivityThread.main(ActivityThread.java:8653)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

thanks @gledezma . This error Detaching surface timed out can occur when detaching the rendering surface timeouts. The surface may be detached when closing playback, putting application in background and bringing it to foreground and application may also change the surface using setSurface API. To triage this further can you find following information.

  • Does this issue happen on a specific device or Android version?
  • Does your app set the surface explicitly using setSurface API?
  • Are you able to reproduce this issue in testing. If yes, can you share repro steps?
  • Are you using Bitmovin native SDK in a native app or as part of some framework like React native or Flutter etc.?

Thanks for the reply @lucky.goyal

Answering the questions:

  • Several devices were triggered, here are some:
  • No, our app does not use setSurface API explicitly on our code
  • No, we weren’t able to reproduce the issue, even trying to reinit the view or going background by a long time period, opening more apps to test devices and/or resources (on real and emulators). The issue actually has not appeared since Sept 10, but maybe Sentry cut us at the issue limit.
  • Native Android Bitmovin SDK 3.23.0, as we said on the first post.

Thanks in advance.

Hi @gledezma , thanks for answers. My last question was also about the framework in which Bitmovin native Android SDK is being used in your app. Are you using any framework like React Native or Flutter, I guess the answer is no, can you please confirm?

This issue is also reported in general for Exoplayer and is believed to related to device/firmware. Please see the related Exoplayer tickets below.

Can you please also check and share the percentage of impacted playback sessions to understand the severity of the issue? Additionally, it seems to happen when releasing the player which means that this may not impact playback experience. If you are using custom native UI, then you may treat this player error Detaching surface timed out as non-fatal error and not show it to user.

We will be investigate this internally and also tracking Exoplayer tickets for any solutions.

Hi, @lucky.goyal

Oh sorry, my bad, but the answer is no, no frameworks, only kotlin and native android.

We tested with the newest version, we did an update and the issue seems to be reduced or maybe gone. We will be monitoring, but for now, all is ok.

Thank you very much.

Edit: impact data

  • From a pool of 35k users, more than 40 users got the issue.
  • Last check was yesterday, 6 users

We don’t know what fixed this issue, but is not appearing anymore.

Close this thread if you want.

Hi @gledezma , thanks for the update. Glad that the issue seems to be resolved. I believe the main change was to upgrade to latest player version. Thanks again for reporting this. This is helpful information for other community members.

Update: A fix is added since Bitmovin Android player SDK 3.30.0 to address Detaching Surface timed out error.