[Spice-devel] [spice-gtk v2 8/9] channel-main: avoid race around file-transfer flush

Christophe Fergeau cfergeau at redhat.com
Wed Aug 3 12:00:54 UTC 2016


On Wed, Aug 03, 2016 at 01:57:15PM +0200, Victor Toso wrote:
> Hi,
> 
> On Wed, Aug 03, 2016 at 12:11:28PM +0200, Christophe Fergeau wrote:
> > On Tue, Aug 02, 2016 at 11:48:49AM +0200, Victor Toso wrote:
> > > This patch avoids a race condition. The race happens when we mark the
> > > xfer-task as completed by receiving VD_AGENT_FILE_XFER_STATUS_SUCCESS
> > > message while the flush callback was not yet called.
> > > 
> > > The flush callback is file_xfer_data_flushed_cb() and it might not be
> > > called immediately after data is flushed.
> > > 
> > > The race can be verified while transferring several small files at
> > > once. I can see it often with more then 50 files in one transfer
> > > operation.
> > 
> > I've also been able to reliably hit this running in valgrind.
> > 
> > > 
> > > This fix implies that SpiceMainChannel should check in its async
> > > callbacks if given SpiceFileTransferTask is completed.
> > > 
> > > This patch introduces spice_file_transfer_task_is_completed (internal)
> > > to help check if spice_file_transfer_task_completed() was called or
> > > not.
> >
> > I wondered if we could cancel the pending async callbacks rather than
> > doing things this way, but it's probably more complicated to do that.
> 
> Yes, It would be more complicated. I guess this 'completed' state could
> be converted to a property and we can use g_object_notify() to trigger a
> the cancellation ..? We also would need to change the GCancellable in
> this flush_async() function as we are using the SpiceFileTransferTask.
> 
> Not sure if we would gain much from it but I could give it a try.

I would say don't bother, unless you really want to take a look now.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160803/f2d91c02/attachment.sig>


More information about the Spice-devel mailing list