Bug 100565 - nicesrc gst element failing (reason not-linked) while removing it
Summary: nicesrc gst element failing (reason not-linked) while removing it
Status: RESOLVED MOVED
Alias: None
Product: Farstream
Classification: Unclassified
Component: Core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Olivier Crête
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-04 19:42 UTC by Fabrice Bellet
Modified: 2018-08-21 12:16 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
gdb session (11.03 KB, text/plain)
2017-04-04 19:46 UTC, Fabrice Bellet
Details
GST related log file (edited) (491.70 KB, text/plain)
2017-04-04 19:51 UTC, Fabrice Bellet
Details
rtp: stop the transmitter before unlinking its sink (stream destroy case) (1.48 KB, patch)
2017-04-05 16:35 UTC, Fabrice Bellet
Details | Splinter Review
nice transmitter: Flush source before stopping (1.15 KB, patch)
2017-06-05 23:28 UTC, Olivier Crête
Details | Splinter Review
gstreamer pipeline dot file when reaching gstbasesrc.c:2950 (110.72 KB, text/plain)
2017-06-13 12:32 UTC, Fabrice Bellet
Details
gstreamer pipeline dot file when reaching gstbasesrc.c:2950 (the good one) (122.83 KB, text/plain)
2017-06-13 12:33 UTC, Fabrice Bellet
Details
gdb backtrace matching previous dot file (9.71 KB, text/plain)
2017-06-13 12:55 UTC, Fabrice Bellet
Details
flush source before unlinking (1.21 KB, patch)
2017-06-14 11:48 UTC, Fabrice Bellet
Details | Splinter Review

Description Fabrice Bellet 2017-04-04 19:42:44 UTC
Hi!

I encountered this bug while removing the video stream (and the video stream only) in a fsrtpsession in empathy. The problem happens while the  farstream session is destroyed, there is some kind of race, when the nicesrc element transition changes from PLAYING to PAUSED to READY, and still handles buffers, without an attached sink, causing the not-linked error in the basesrc gst element. 

This error being fatal for the pipeline, the connection is unexpectedly closed in the client.
Comment 1 Fabrice Bellet 2017-04-04 19:46:58 UTC
Created attachment 130674 [details]
gdb session

The nicesrc70:src thread stops in gstbasesrc.c:2950, when the "streaming stopped, reason not-linked" error is generated. At the same time, the main thread is locked while changing the nicesrc state from PAUSED to READY.
Comment 2 Fabrice Bellet 2017-04-04 19:51:46 UTC
Created attachment 130675 [details]
GST related log file (edited)

the interesting part of the log is just before the jump from timestamp 0:15:17 to 12:04:29 (this gap is because empathy-call remained stopped in the debugger for quite a long time, before continuing), following the nicesrc70 element.
Comment 3 Fabrice Bellet 2017-04-04 20:36:42 UTC
I reassign this bug to the Farstream product instead.
Comment 4 Fabrice Bellet 2017-04-05 16:35:06 UTC
Created attachment 130701 [details] [review]
rtp: stop the transmitter before unlinking its sink (stream destroy case)

This patch seems to work for me, by stopping the nicesrc element, before removing it from the bin.
Comment 5 Olivier Crête 2017-04-05 17:02:59 UTC
Comment on attachment 130701 [details] [review]
rtp: stop the transmitter before unlinking its sink (stream destroy case)

Review of attachment 130701 [details] [review]:
-----------------------------------------------------------------

That may result in a EOS event being sent downstream which may break other FsStreams connected to the same FsSession


And the patch subject is wrong, your unlinking the source there..
Comment 6 Olivier Crête 2017-06-05 23:28:11 UTC
Created attachment 131729 [details] [review]
nice transmitter: Flush source before stopping

Maybe we should just send a flush to the source first. Here is a patch that does just that. Let me know if this helps.
Comment 7 Fabrice Bellet 2017-06-13 12:32:31 UTC
Created attachment 131920 [details]
gstreamer pipeline dot file when reaching gstbasesrc.c:2950
Comment 8 Fabrice Bellet 2017-06-13 12:33:49 UTC
Created attachment 131923 [details]
gstreamer pipeline dot file when reaching gstbasesrc.c:2950 (the good one)
Comment 9 Fabrice Bellet 2017-06-13 12:55:53 UTC
Created attachment 131924 [details]
gdb backtrace matching previous dot file

The patch from comment #6 doesn't help. 

What seems interesting in this backtrace compared to the backtrace from bug #100586 is that fs_rtp_stream_dispose() is called *before* fs_rtp_session_dispose(), which explains why the conference bin is not stopped, and the removal of the nicesrc88 element from the bin91 GstBin causes this not-linked error.

The other (working) call stack should be fs_rtp_session_dispose() --> fs_stream_destroy() --> fs_rtp_stream_dispose() --> fs_stream_transmitter_stop(), and in that case the gst-src transmitters would stopped first.

The junction point where the behaviour diverges is in call-content.c:2363 in telepathy-farstream. When the stream is not destroyed there, the session is destroyed in _tf_call_content_destroy().

I wonder if the order of destruction should not be forced in _tf_call_content_destroy() ?
Comment 10 Fabrice Bellet 2017-06-14 11:48:59 UTC
Created attachment 131951 [details] [review]
flush source before unlinking

Would it be correct to send the flush event before removing the nice source and not after ?
Comment 11 GitLab Migration User 2018-08-21 12:16:07 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/farstream/farstream/issues/4.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.