gstreamer/ext/curl
Sebastian Rasmussen c7e4217121 curlsmtpsink: Lock and don't send final boundary upon error
Previously GstCurlSmtpSink could cause the pipeline thread to end up
waiting for a stopped thread to perform work.

The scenario was that the sink could be rendering a buffer and waiting
for the curl transfer thread to have sent the data. As soon as the
transfer thread has copied all data to curl's data buffer in
gst_curl_base_sink_transfer_read_cb() then the render call would stop
waiting and return GST_FLOW_OK. While this takes place the transfer
thread may suffer from an error e.g. due gst_poll_wait() timing out.
This causes the transfer thread to record the error, claim (it is not
really true since there was an error) that the data has been sent and
that a response has been received by trying to signal the pipeline
thread (but this has already stopped waiting). Finally the transfer
thread stops itself. A short while later the pipeline thread may attempt
to push an EOS event into GstCurlSmtpSink. Since there is no check in
gst_curl_smtp_sink_event() to check if the sink has suffered from any
error it may attempt to add a final boundary and ask the, now deceased,
transfer thread to transfer the new data. Next the sink element would
have waited for the transfer to complete (using a different mechanism
than normal transfers through GstCurlBaseSink). In this case there was
an error check to avoid waiting if an error had already been seen.
Finally GstCurlSmtpSink would chain up to GstCurlBaseSink which would
then block waiting for a response (normally this would be prevented by
the transfer thread suffering the error claiming that it had been
received, but GstCurlSmtpSink clobbered this flag after the fact).

Now GstCurlSmtpSink avoids this by locking over the entire event handing
(preventing simultaneous changes to flags by the two threads) and also
by avoiding to initiate transfer of final boundary if an error has
already been seen.

Also add GST_FIXME() for remaining similar issue where the pipeline
thread may block indefinitely waiting for transfer thread to transfer
data but the transfer thread errors out and fails to notify the pipeline
thread that the transfer failed.

https://bugzilla.gnome.org/show_bug.cgi?id=767501
2016-06-11 11:25:13 +01:00
..
gstcurl.c curl: curlsftpsink - new libcurl-based sink element for SFTP 2013-11-01 17:20:04 +01:00
gstcurlbasesink.c curlsink: catch an unknown error 2016-04-04 17:48:55 +01:00
gstcurlbasesink.h curlsink: handle socket callback for active FTP connections as well 2015-05-25 19:37:53 +01:00
gstcurlfilesink.c plugins-bad: Fix example pipelines 2015-12-15 10:30:49 +00:00
gstcurlfilesink.h Fix FSF address 2012-11-04 00:09:59 +00:00
gstcurlftpsink.c plugins-bad: Fix example pipelines 2015-12-15 10:30:49 +00:00
gstcurlftpsink.h curl*sink: fix some gst-indent problems 2014-04-26 10:20:11 +02:00
gstcurlhttpsink.c plugins-bad: Fix example pipelines 2015-12-15 10:30:49 +00:00
gstcurlhttpsink.h Fix FSF address 2012-11-04 00:09:59 +00:00
gstcurlsftpsink.c plugins-bad: Fix example pipelines 2015-12-15 10:30:49 +00:00
gstcurlsftpsink.h curl*sink: fix some gst-indent problems 2014-04-26 10:20:11 +02:00
gstcurlsmtpsink.c curlsmtpsink: Lock and don't send final boundary upon error 2016-06-11 11:25:13 +01:00
gstcurlsmtpsink.h curlsmtpsink: add final boundary to all multipart emails 2014-12-19 13:16:43 +00:00
gstcurlsshsink.c curlsshsink: remove redundant else statement 2015-07-06 15:25:16 +01:00
gstcurlsshsink.h curlsshsink: use the locally defined types 2014-10-26 21:04:02 +00:00
gstcurltlssink.c curltlssink: swap check 2014-09-24 22:25:55 +02:00
gstcurltlssink.h Fix FSF address 2012-11-04 00:09:59 +00:00
Makefile.am curl: curlsftpsink - new libcurl-based sink element for SFTP 2013-11-01 17:20:04 +01:00