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 753758 - ios: Does not shut down context and navigation GMainLoop
ios: Does not shut down context and navigation GMainLoop
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.5.2
Other Mac OS
: Normal blocker
: 1.5.91
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-08-18 11:40 UTC by Trung Doan
Modified: 2015-08-28 18:27 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Trung Doan 2015-08-18 11:40:42 UTC
I'm trying to develop a video player on iOS by using GstPlayer at this link:
https://github.com/sdroege/gst-player

After few steps of testing, i met this error at exactly 40th play:
(:6583): GStreamer-CRITICAL **: gst_poll_write_control: assertion 'set != NULL' failed

(:6583): GStreamer-CRITICAL **: gst_poll_write_control: assertion 'set != NULL' failed

(:6583): GStreamer-CRITICAL **: gst_poll_write_control: assertion 'set != NULL' failed

(:6583): GStreamer-CRITICAL **: gst_poll_read_control: assertion 'set != NULL' failed

(:6583): GStreamer-CRITICAL **: gst_poll_write_control: assertion 'set != NULL' failed

(:6583): GStreamer-CRITICAL **: gst_poll_read_control: assertion 'set != NULL' failed

(:6583): GStreamer-CRITICAL **: gst_poll_free: assertion 'set != NULL' failed

if i ignored the error, i saw new error log at 41st play:
(:6583): GLib-ERROR **: Creating pipes for GWakeup: Too many open files

then app crashed.
I experienced the same behavior on iOS Example at this link: http://cgit.freedesktop.org/~slomo/gst-sdk-tutorials/

I assume that gst_object_unref (player) didn't clear all the resources, specifically closing files.
Comment 1 Sebastian Dröge (slomo) 2015-08-18 11:48:46 UTC
As it also happens with the tutorials, this is unrelated to GstPlayer. Something must be leaking file descriptors.


Can you run with G_DEBUG=fatal_warnings set in the environment, and get a backtrace of the first break?
Comment 2 Trung Doan 2015-08-19 04:36:53 UTC
I did search to find a way to get backtrace from GStreamer on iOS app but not successful. Do you have any guidance to make these traces to show on Xcode Terminal?

By the way, to set G_DEBUG=fatal_warnings, I used this g_setenv("G_DEBUG","fatal_warnings", true);

is that correct?
Comment 3 Sebastian Dröge (slomo) 2015-08-19 07:32:20 UTC
That should work if you do it in the very beginning of your application. Alternatively g_log_set_always_fatal(G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR) also works
Comment 4 Trung Doan 2015-08-19 08:15:36 UTC
Thanks,
Here are steps i used to get the log
1/ using g_setenv("G_DEBUG","fatal_warnings", true) in gst_ios_init.m at line 506
2/ Change http url to local video url in LibraryViewController for quicker test.

Here is the log:
1/ At early 40th play:
[33;01mLOG    [00m [00m          gst-player gstplayer.c:774:tick_cb:<player39>[00m Position 0:00:00.190000000

(<unknown>:37600): GStreamer-CRITICAL **: gst_poll_wait: assertion 'set != NULL' failed

(<unknown>:37600): GStreamer-CRITICAL **: gst_poll_wait: assertion 'set != NULL' failed

(<unknown>:37600): GStreamer-CRITICAL **: gst_poll_wait: assertion 'set != NULL' failed

(<unknown>:37600): GStreamer-CRITICAL **: gst_poll_wait: assertion 'set != NULL’ failed

2/ After press back from video view
(<unknown>:37600): GStreamer-CRITICAL **: gst_poll_wait: assertion 'set != NULL' failed

0:03:09.616546000 [335m37600[00m 0x12041b40 [37mTRACE  [00m [00m          gst-player gstplayer.c:402:gst_player_dispose:<player39>[00m Stopping main thread
(<unknown>:37600): GStreamer-CRITICAL **: gst_poll_wait: assertion 'set != NULL' failed
0:03:09.662524000 [335m37600[00m 0x1007daf0 [37mTRACE  [00m [00m          gst-player gstplayer.c:2442:gst_player_main:<player39>[00m Stopped main loop
0:03:09.684337000 [335m37600[00m 0x1007daf0 [37mTRACE  [00m [00m          gst-player gstplayer.c:2472:gst_player_main:<player39>[00m Stopped main thread
0:03:09.684564000 [335m37600[00m 0x12041b40 [37mTRACE  [00m [00m          gst-player gstplayer.c:425:gst_player_finalize:<player39>[00m Finalizing

3/ Early start of 41st play:
(<unknown>:37600): GStreamer-CRITICAL **: gst_poll_write_control: assertion 'set != NULL' failed

(<unknown>:37600): GStreamer-CRITICAL **: gstsystemclock: write control failed in wakeup_async: 2:No such file or directory


(<unknown>:37600): GStreamer-CRITICAL **: gst_poll_free: assertion 'set != NULL' failed
0:03:21.269160000 [335m37600[00m 0x12041b40 [37mTRACE  [00m [00m          gst-player gstplayer.c:233:gst_player_init:<GstPlayer@0x1008fd70>[00m Initializing
0:03:21.269215000 [335m37600[00m 0x12041b40 [37mTRACE  [00m [00m          gst-player gstplayer.c:248:gst_player_init:<GstPlayer@0x1008fd70>[00m Initialized
0:03:21.269243000 [335m37600[00m 0x12041b40 [37mTRACE  [00m [00m          gst-player gstplayer.c:449:gst_player_constructed:<player40>[00m Constructed
0:03:21.269337000 [335m37600[00m 0x1007dac0 [37mTRACE  [00m [00m          gst-player gstplayer.c:2367:gst_player_main:<player40>[00m Starting main thread
0:03:21.269554000 [335m37600[00m 0x1007dac0 [37mTRACE  [00m [00m          gst-player gstplayer.c:2440:gst_player_main:<player40>[00m Starting main loop
0:03:21.269579000 [335m37600[00m 0x1007dac0 [37mTRACE  [00m [00m          gst-player gstplayer.c:685:main_loop_running_cb:<player40>[00m Main loop running now
0:03:21.269621000 [335m37600[00m 0x12041b40 [37mDEBUG  [00m [00m          gst-player gstplayer.c:537:gst_player_set_property:<player40>[00m Set uri=file:///Users/TrungKent/Library/Developer/CoreSimulator/Devices/54B5E6FB-8E43-424A-B4A1-CC32F0324E5A/data/Containers/Bundle/Application/929A2385-A650-4BDA-B1CE-5DB6B34C5730/GstPlay.app/D0002031104_00000_V_000.mp4
0:03:21.269675000 [335m37600[00m 0x1007dac0 [37mDEBUG  [00m [00m          gst-player gstplayer.c:2681:gst_player_stop_internal:<player40>[00m Stop
0:03:21.269758000 [335m37600[00m 0x1007dac0 [37mDEBUG  [00m [00m          gst-player gstplayer.c:469:gst_player_set_uri_internal:<player40>[00m Changing URI to 'file:///Users/TrungKent/Library/Developer/CoreSimulator/Devices/54B5E6FB-8E43-424A-B4A1-CC32F0324E5A/data/Containers/Bundle/Application/929A2385-A650-4BDA-B1CE-5DB6B34C5730/GstPlay.app/D0002031104_00000_V_000.mp4'
0:03:21.269838000 [335m37600[00m 0x1007dac0 [37mDEBUG  [00m [00m          gst-player gstplayer.c:2541:gst_player_play_internal:<player40>[00m Play
0:03:21.269916000 [335m37600[00m 0x1007dac0 [37mDEBUG  [00m [00m          gst-player gstplayer.c:723:change_state:<player40>[00m Changing app state from stopped to buffering
0:03:21.281521000 [335m37600[00m 0x1007dac0 [37mDEBUG  [00m [00m          gst-player gstplayer.c:1377:state_changed_cb:<player40>[00m Changed state old: NULL new: READY pending: VOID_PENDING

(<unknown>:37600): GStreamer-CRITICAL **: gst_poll_get_read_gpollfd: assertion 'set != NULL' failed

(<unknown>:37600): GLib-ERROR **: Creating pipes for GWakeup: Too many open files

If i did wrong, please correct me :)
Comment 5 Sebastian Dröge (slomo) 2015-08-19 08:28:45 UTC
It should've jumped into the debugger on the first critical warning. Try with g_log_set_always_fatal(G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR)
Comment 6 Trung Doan 2015-08-19 08:50:31 UTC
After using g_log_set_always_fatal(G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR) in gst_ios_init.m at line 506. Application freezes at 40th play. 

Here is the log:
0:03:23.927064000 [332m38491[00m 0x1180acf0 [37mDEBUG  [00m [00m          gst-player gstplayer.c:1377:state_changed_cb:<player39>[00m Changed state old: PAUSED new: PLAYING pending: VOID_PENDING
0:03:23.927099000 [332m38491[00m 0x1180acf0 [37mDEBUG  [00m [00m          gst-player gstplayer.c:723:change_state:<player39>[00m Changing app state from buffering to playing

(<unknown>:38491): GStreamer-CRITICAL **: gst_poll_wait: assertion 'set != NULL' failed

I also upload the image of xcode debugging
https://goo.gl/photos/gPZqM7k2Y1R7G7uZ9
Comment 7 Trung Doan 2015-08-24 04:33:05 UTC
Hi Sebastian,
Sorry for bothering you.
I just want to ask about this issue. Do we have any progress?
If you need more information, please response to me.
Thank you
Comment 8 Sebastian Dröge (slomo) 2015-08-24 08:12:00 UTC
Can you get a backtrace of all threads when it stops? Unfortunately SIGTRAP goes to the main thread on iOS (which is completely useless...), so you need to explicitely get backtraces of the other threads.
Comment 9 Trung Doan 2015-08-25 03:34:15 UTC
Hi Sebastian,
I got the backtrace of all threads when app stops. The backtrace is quite large so i've uploaded it to Google Drive. Please check it
https://drive.google.com/file/d/0B5HfO78zInwHZDFSc0lCWTNBWnM/view?usp=sharing
Comment 10 Sebastian Dröge (slomo) 2015-08-25 07:05:35 UTC
This basically looks like the GL context is leaked somewhere, as the window main loop is quit in its finalize, and the navigation main loop is quit in the window's finalize.
Comment 11 Sebastian Dröge (slomo) 2015-08-25 07:10:57 UTC
Can you try building GStreamer from source to see if the following commit fixes it for you? I don't have any Apple hardware around me currently.

commit 5c106c0c2af22192fdc2ffbf110795f738e5adb6
Author: Sebastian Dröge <sebastian@centricular.com>
Date:   Tue Aug 25 10:09:14 2015 +0300

    gl/eagl: Unref context after setting a window handle
    
    gst_gl_window_get_context() returns a new reference.
    
    Hopefully fixes https://bugzilla.gnome.org/show_bug.cgi?id=753758
Comment 12 Trung Doan 2015-08-25 07:21:07 UTC
Hi Sebastian,
Thank you for your fix.
I've never built GStreamer from source code before so I may need a little time to find out how to. I will report to you the status of issue as soon as i can build and so some tests.
Thank you.
Comment 13 Sebastian Dröge (slomo) 2015-08-25 07:22:54 UTC
You can find some build instructions here: http://cgit.freedesktop.org/gstreamer/cerbero/tree/README

Also make sure to get cerbero from here: git://anongit.freedesktop.org/gstreamer/cerbero


If you have any problems, please write me a mail (or to the mailing list), or come on IRC :) Thanks!
Comment 14 Trung Doan 2015-08-26 10:12:44 UTC
Hi Sebastian,
Good news. 
I have built and tested your new patch. It worked
No more crash by Too Many open files error.
Thank you
Comment 15 Sebastian Dröge (slomo) 2015-08-26 10:26:29 UTC
Thanks for testing! :)