google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.7k stars 6.02k forks source link

RTMP - Fatal signal 11 (SIGSEGV) when switching into airplane mode #3597

Closed keremkusmezer closed 6 years ago

keremkusmezer commented 6 years ago

Issue description

During RTMP stream playback with Exoplayer, when i switch the phone to airplane mode, exoplayer throws the following exception , the error handler block of exoplayer doesn't get called and the process dies.

E ExoPlayerImplInternal: Source error.
E ExoPlayerImplInternal: net.butterflytv.rtmp_client.RtmpClient$RtmpIOException
E ExoPlayerImplInternal:    at net.butterflytv.rtmp_client.RtmpClient.open(RtmpClient.java:55)
E ExoPlayerImplInternal:    at com.google.android.exoplayer2.ext.rtmp.RtmpDataSource.open(RtmpDataSource.java:57)
E ExoPlayerImplInternal:    at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:141)
E ExoPlayerImplInternal:    at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:702)
E ExoPlayerImplInternal:    at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:315)
E ExoPlayerImplInternal:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
E ExoPlayerImplInternal:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
E ExoPlayerImplInternal:    at java.lang.Thread.run(Thread.java:764)
F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0xc22e83b4 in tid 22827 (Loader:Extracto), pid 21732 ()

Reproduction steps

Just start playing any stream with exoplayer and then switch to airplane mode or close the network connection.

        final BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
        final TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
        TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
        player = ExoPlayerFactory.newSimpleInstance(getContext(), trackSelector);
        Surface videoSurface = new Surface(getSurfaceTexture());
        player.setVideoSurface(videoSurface);
        DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(getContext(), "testapplication");
        ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
        MediaSource videoSource =
                new ExtractorMediaSource(Uri.parse(getCurrentVideoUrl()),
                        dataSourceFactory,
                        extractorsFactory,
                        null,
                        null);
        player.addListener(new PlayerEventHandler(this));
        player.setRepeatMode(Player.REPEAT_MODE_ALL);
        player.prepare(videoSource);

Link to test content

Version of ExoPlayer being used

Exoplayer 2.6.0 is used //Exoplayer Support Added Here implementation 'com.google.android.exoplayer:exoplayer:2.6.0' //Support For Rtmp Streaming Added Here implementation 'com.google.android.exoplayer:extension-rtmp:2.6.0'

Device(s) and version(s) of Android being used

NEXUS 5 7.0 GM5 Plus 7.0 Android Emulator Android 8.1.0 Android Emulator Android 8.0

A full bug report captured from the device

bugreport-sdk_gphone_x86-OPM1.171004.001-2017-12-16-00-05-18.zip

ojw28 commented 6 years ago

Relevant part of the bug report:

12-16 00:04:59.321 10080 23330 29613 E ExoPlayerImplInternal: Source error.
12-16 00:04:59.321 10080 23330 29613 E ExoPlayerImplInternal: net.butterflytv.rtmp_client.RtmpClient$RtmpIOException
12-16 00:04:59.321 10080 23330 29613 E ExoPlayerImplInternal:   at net.butterflytv.rtmp_client.RtmpClient.open(RtmpClient.java:55)
12-16 00:04:59.321 10080 23330 29613 E ExoPlayerImplInternal:   at com.google.android.exoplayer2.ext.rtmp.RtmpDataSource.open(RtmpDataSource.java:57)
12-16 00:04:59.321 10080 23330 29613 E ExoPlayerImplInternal:   at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:141)
12-16 00:04:59.321 10080 23330 29613 E ExoPlayerImplInternal:   at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:702)
12-16 00:04:59.321 10080 23330 29613 E ExoPlayerImplInternal:   at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:315)
12-16 00:04:59.321 10080 23330 29613 E ExoPlayerImplInternal:   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
12-16 00:04:59.321 10080 23330 29613 E ExoPlayerImplInternal:   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
12-16 00:04:59.321 10080 23330 29613 E ExoPlayerImplInternal:   at java.lang.Thread.run(Thread.java:764)
12-16 00:04:59.322 10080 23330 29614 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0xc1feefb4 in tid 29614 (Loader:Extracto), pid 23330 (co.wormapp.worm)
12-16 00:04:59.342 10080 23330 23330 D wormlog : Player exception occurred:com.google.android.exoplayer2.ExoPlaybackException
12-16 00:04:59.342 10080 23330 23330 D wormlog : Player rtmp exception occurred:-3
12-16 00:04:59.342 10080 23330 23330 I ExoPlayerImpl: Release 1d5c0fe [ExoPlayerLib/2.6.0] [generic_x86, Android SDK built for x86, Google, 27] [goog.exo.core, goog.exo.rtmp]
12-16 00:04:59.338 10080 29670 29670 W crash_dump32: type=1400 audit(0.0:17): avc: denied { search } for name="uk.co.wormapp.worm" dev="dm-0" ino=115523 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
12-16 00:04:59.382 10080 29670 29670 I crash_dump32: obtaining output fd from tombstoned, type: kDebuggerdTombstone
12-16 00:04:59.382  1058  1511  1511 I /system/bin/tombstoned: received crash request for pid 23330
12-16 00:04:59.385 10080 29670 29670 I crash_dump32: performing dump of process 23330 (target tid = 29614)
12-16 00:04:59.385 10080 29670 29670 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-16 00:04:59.385 10080 29670 29670 F DEBUG   : Build fingerprint: 'google/sdk_gphone_x86/generic_x86:8.1.0/OPM1.171004.001/4376136:user/release-keys'
12-16 00:04:59.385 10080 29670 29670 F DEBUG   : Revision: '0'
12-16 00:04:59.385 10080 29670 29670 F DEBUG   : ABI: 'x86'
12-16 00:04:59.385 10080 29670 29670 F DEBUG   : pid: 23330, tid: 29614, name: Loader:Extracto  >>> uk.co.wormapp.worm <<<
12-16 00:04:59.385 10080 29670 29670 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc1feefb4
12-16 00:04:59.385 10080 29670 29670 F DEBUG   :     eax 13805f60  ebx fff80000  ecx 8a180000  edx 00000063
12-16 00:04:59.385 10080 29670 29670 F DEBUG   :     esi ae7df79c  edi 8a182444
12-16 00:04:59.385 10080 29670 29670 F DEBUG   :     xcs 00000073  xds 0000007b  xes 0000007b  xfs 0000003b  xss 0000007b
12-16 00:04:59.385 10080 29670 29670 F DEBUG   :     eip ae793921  ebp 8207f6c8  esp 8207f660  flags 00010a07
12-16 00:04:59.387 10080 29670 29670 F DEBUG   : 
12-16 00:04:59.387 10080 29670 29670 F DEBUG   : backtrace:
12-16 00:04:59.387 10080 29670 29670 F DEBUG   :     #00 pc 00093921  /system/lib/libc.so (arena_run_dalloc+113)
12-16 00:04:59.387 10080 29670 29670 F DEBUG   :     #01 pc 0008e500  /system/lib/libc.so (arena_dalloc_large_locked_impl+224)
12-16 00:04:59.387 10080 29670 29670 F DEBUG   :     #02 pc 0008e40b  /system/lib/libc.so (je_arena_dalloc_large_junked_locked+43)
12-16 00:04:59.387 10080 29670 29670 F DEBUG   :     #03 pc 000b2cea  /system/lib/libc.so (je_tcache_bin_flush_large+378)
12-16 00:04:59.387 10080 29670 29670 F DEBUG   :     #04 pc 000b3c0f  /system/lib/libc.so (tcache_destroy+607)
12-16 00:04:59.387 10080 29670 29670 F DEBUG   :     #05 pc 000b3994  /system/lib/libc.so (je_tcache_cleanup+36)
12-16 00:04:59.387 10080 29670 29670 F DEBUG   :     #06 pc 000b4436  /system/lib/libc.so (je_tsd_cleanup+70)
12-16 00:04:59.387 10080 29670 29670 F DEBUG   :     #07 pc 000b54bc  /system/lib/libc.so (je_tsd_cleanup_wrapper+44)
12-16 00:04:59.387 10080 29670 29670 F DEBUG   :     #08 pc 00071b84  /system/lib/libc.so (pthread_key_clean_all()+164)
12-16 00:04:59.387 10080 29670 29670 F DEBUG   :     #09 pc 000715d9  /system/lib/libc.so (pthread_exit+89)
12-16 00:04:59.387 10080 29670 29670 F DEBUG   :     #10 pc 0007144d  /system/lib/libc.so (__pthread_start(void*)+61)
12-16 00:04:59.387 10080 29670 29670 F DEBUG   :     #11 pc 000205db  /system/lib/libc.so (__start_thread+75)
12-16 00:04:59.387 10080 29670 29670 F DEBUG   :     #12 pc 0001ec16  /system/lib/libc.so (__bionic_clone+70)
keremkusmezer commented 6 years ago

Any fixes or news regarding that?

ojw28 commented 6 years ago

If the native crash is coming from LibRtmp then there's not really much we can do to fix it. You'll need to report it here instead. When they provide a fix we'll move to depend on the newer version to pick it up (it would also be possible for you to do this ahead of us).

ojw28 commented 6 years ago

Root cause is tracked in https://github.com/ant-media/LibRtmp-Client-for-Android/issues/52.

ojw28 commented 6 years ago

@mekya - Does switching to 3.0.1 as in https://github.com/google/ExoPlayer/pull/3746 fix this issue, or is this one something else? Thanks!

mekya commented 6 years ago

Still I could not reproduce this bug on my test environment. Even if I have tried today again.

Btw, new release 3.0.1 has fixes some error while network is not reachable(airplane mode, etc.) or server is down.

ojw28 commented 6 years ago

Let's optimistically assume moving to 3.0.1 fixes the issue.