After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 793383 - Crashing on iOS: [ALAssetRepresentation release]: message sent to deallocated instance, [GstAssetsLibrary .cxx_destruct] XCode 9.2, iOS 11.2 (15C107)
Crashing on iOS: [ALAssetRepresentation release]: message sent to deallocated...
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.12.3
Other Mac OS
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-02-12 13:14 UTC by Louis Le
Modified: 2018-11-03 14:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Crashing line (309.58 KB, image/png)
2018-02-13 04:57 UTC, Louis Le
Details

Description Louis Le 2018-02-12 13:14:41 UTC
I'm stuck on crashing issue: message sent to deallocated instance zombie object with GStreamer tutorial project for iOS with this version of XCode, the app crashes when trying to unref the player or pipeline after playing a AVI file saved in Camera Roll using ALAsset with prefix: 
assets-library://asset/asset.AVI?id=ID_OF_AVI_FILE&ext=AVI.

Crash point: typefind:sink -> [GstAssetsLibrary .cxx_destruct]

Crash callStackSymbols

<_NSCallStackArray 0x604000452180>(
0   ???                                 0x00000001226dbf1c 0x0 + 4872584988,
1   Tutorial 5                          0x0000000103211300 main + 0,
2   libobjc.A.dylib                     0x000000010bbb6912 _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 127,
3   libobjc.A.dylib                     0x000000010bbc21a4 objc_destructInstance + 124,
4   libobjc.A.dylib                     0x000000010bbc21db object_dispose + 22,
5   AssetsLibrary                       0x00000001088a6acd -[ALAssetsLibrary dealloc] + 98,
6   libobjc.A.dylib                     0x000000010bbcca2e _ZN11objc_object17sidetable_releaseEb + 202,
7   libobjc.A.dylib                     0x000000010bbcd178 _ZN12_GLOBAL__N_119AutoreleasePoolPage3popEPv + 860,
8   libobjc.A.dylib                     0x000000010bbce31b _ZN12_GLOBAL__N_119AutoreleasePoolPage11tls_deallocEPv + 127,
9   libsystem_pthread.dylib             0x000000010ca0f27e _pthread_tsd_cleanup + 534,
10  libsystem_pthread.dylib             0x000000010ca0efbd _pthread_exit + 79,
11  libsystem_pthread.dylib             0x000000010ca0d6cc pthread_sigmask + 0,
12  libsystem_pthread.dylib             0x000000010ca0d56d _pthread_body + 0,
13  libsystem_pthread.dylib             0x000000010ca0cc5d thread_start + 13
)

>https://github.com/sdroege/gst-player
>https://github.com/GStreamer/gst-docs/tree/master/examples/tutorials/xcode%20iOS
Comment 1 Louis Le 2018-02-12 13:41:42 UTC
Please review the issue or let me know how to solve this issue.
Thanks
Comment 2 Sebastian Dröge (slomo) 2018-02-12 15:57:04 UTC
Please get a stacktrace with line numbers and also a GStreamer debug log, if possible.
Comment 3 Louis Le 2018-02-13 04:54:53 UTC
Hi,
I saw these GStreamer last lines of debug log:
 
gst-player gstplayer.c:942:tick_cb:<player0>[00m Position 0:00:03.063842062
0:00:17.840929000 [336m 5693[00m 0x7f83e40a6180 [37mTRACE  [00m [00m          gst-player gstplayer.c:490:gst_player_dispose:<player0>[00m Stopping main thread
0:00:17.841182000 [336m 5693[00m 0x7f83e3330320 [37mTRACE  [00m [00m          gst-player gstplayer.c:2971:gst_player_main:<player0>[00m Stopped main loop
0:00:17.848277000 [336m 5693[00m 0x7f83e3330320 [37mTRACE  [00m [00m          gst-player gstplayer.c:2999:gst_player_main:<player0>[00m Stopped main thread
0:00:17.848504000 [336m 5693[00m 0x7f83e40a6180 [37mTRACE  [00m [00m          gst-player gstplayer.c:513:gst_player_finalize:<player0>[00m Finalizing
2018-02-13 11:47:26.134074+0700 GstPlay[5693:103692] *** -[ALAssetRepresentation release]: message sent to deallocated instance 0x600000a363c0

And the stacktrace I attached in the first comment. It crash in this line after play an AVI load from iOS asset library (If we are not play the video then unref, it's ok but not if we press play): 
gst_object_unref(player);

I and there are more information about crash:
GstPlay`-[GstAssetsLibrary .cxx_destruct]:
    0x10e9058ab <+0>:  pushq  %rbp
    0x10e9058ac <+1>:  movq   %rsp, %rbp
    0x10e9058af <+4>:  pushq  %rbx
    0x10e9058b0 <+5>:  pushq  %rax
    0x10e9058b1 <+6>:  movq   %rdi, %rbx
    0x10e9058b4 <+9>:  movq   0x25e3d75(%rip), %rdi     ; GstAssetsLibrary.result
    0x10e9058bb <+16>: addq   %rbx, %rdi
    0x10e9058be <+19>: xorl   %esi, %esi
    0x10e9058c0 <+21>: callq  0x110636ab8               ; symbol stub for: objc_storeStrong
//Crashing line
    0x10e9058c5 <+26>: addq   0x25e3d5c(%rip), %rbx     ; GstAssetsLibrary.asset (avidemux0:sink (14): EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
//
    0x10e9058cc <+33>: xorl   %esi, %esi
    0x10e9058ce <+35>: movq   %rbx, %rdi
    0x10e9058d1 <+38>: addq   $0x8, %rsp
    0x10e9058d5 <+42>: popq   %rbx
    0x10e9058d6 <+43>: popq   %rbp
    0x10e9058d7 <+44>: jmp    0x110636ab8               ; symbol stub for: objc_storeStrong

(In reply to Sebastian Dröge (slomo) from comment #2)
> Please get a stacktrace with line numbers and also a GStreamer debug log, if
> possible.
Comment 4 Louis Le 2018-02-13 04:57:16 UTC
Created attachment 368285 [details]
Crashing line

I just summited an image for more information
Comment 5 Louis Le 2018-02-13 05:01:41 UTC
Please let me know how can I provide more information to help you re-procedure or detecting the issue. Thanks you :(
Comment 6 Sebastian Dröge (slomo) 2018-02-13 07:41:12 UTC
Not clear what the problem here is, it does not crash directly in the GStreamer code but somewhere in a C++ (?!) destructor.

The code in question would be here in any case:
https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/sys/applemedia/iosassetsrc.m

The destruction of the GstAssetsLibrary seems to be the problem somehow
Comment 7 Louis Le 2018-02-13 08:12:10 UTC
The tutorial running well in previous version (I cannot remember which version is) but I encountered this issue in current version of XCode with GstPlayer and gst_parse_launch("playbin",NULL).

The code I'm using:

#import <gst/player/player.h>

//ViewDidLoad
render = gst_player_video_overlay_video_renderer_new ((__bridge gpointer)(video_view));
player = gst_player_new (render, NULL);
g_object_set (player, "uri", [uri UTF8String], NULL);

//viewDidDisappear
if (player)
    {
	gst_object_unref(player);
    }

Is it my fault in code flow? What I should do to run the tutorial project with current verion of XCode? Thanks for your help :( 

(In reply to Sebastian Dröge (slomo) from comment #6)
> Not clear what the problem here is, it does not crash directly in the
> GStreamer code but somewhere in a C++ (?!) destructor.
> 
> The code in question would be here in any case:
> https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/sys/applemedia/
> iosassetsrc.m
> 
> The destruction of the GstAssetsLibrary seems to be the problem somehow
Comment 8 Sebastian Dröge (slomo) 2018-02-13 08:36:42 UTC
It's not a problem in your code. But it would help a lot if you could find out which version was working, and which version did not :)
Comment 9 Louis Le 2018-02-13 10:38:25 UTC
I will try another versions and let you know as soon as possible but hope that you can detect it soon. Thanks for your help. :D.
Comment 10 Jan Schmidt 2018-02-14 11:20:50 UTC
I see the same crash with Tutorial 5 after playing a .mov file from the asset library.

The crash is indeed during freeing of the GstAssetsLibrary

* thread #20, name = 'qtdemux0:sink', stop reason = EXC_BAD_ACCESS (code=1, address=0x20)
  * frame #0: 0x00000001842057f4 libobjc.A.dylib`objc_object::release() + 16
    frame #1: 0x0000000100c9370c Tutorial 5`-[GstAssetsLibrary .cxx_destruct](self=0x0000000107838bf0, _cmd=<unavailable>) at iosassetsrc.m:441 [opt]
    frame #2: 0x00000001841e6ef4 libobjc.A.dylib`object_cxxDestructFromClass(objc_object*, objc_class*) + 148
    frame #3: 0x00000001841f4638 libobjc.A.dylib`objc_destructInstance + 88
    frame #4: 0x00000001841f4690 libobjc.A.dylib`object_dispose + 16
    frame #5: 0x00000001960ed99c AssetsLibrary`-[ALAssetsLibrary dealloc] + 100
    frame #6: 0x0000000184206138 libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 836
    frame #7: 0x0000000184207e2c libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::tls_dealloc(void*) + 144
    frame #8: 0x0000000184bc75e4 libsystem_pthread.dylib`_pthread_tsd_cleanup + 572
    frame #9: 0x0000000184bc7334 libsystem_pthread.dylib`_pthread_exit + 88
    frame #10: 0x0000000184bc82c0 libsystem_pthread.dylib`_pthread_body + 320
    frame #11: 0x0000000184bc8180 libsystem_pthread.dylib`_pthread_start + 312
    frame #12: 0x0000000184bc6b74 libsystem_pthread.dylib`thread_start + 4
Comment 11 GStreamer system administrator 2018-11-03 14:18:05 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/655.