Bug 94662 - Coroutines may be messing up with GTask's return
Summary: Coroutines may be messing up with GTask's return
Status: RESOLVED MOVED
Alias: None
Product: Spice
Classification: Unclassified
Component: spice-gtk (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Spice Bug List
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-22 18:51 UTC by Fabiano Fidêncio
Modified: 2018-06-03 10:19 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Fabiano Fidêncio 2016-03-22 18:51:31 UTC
I've seen some weird behaviors of the GTask returning immediately when it was supposed to return in idle, in spice-gtk code.

What I got from a brief talk with Dan Winship is that "a GTask will return immediately only if:
(a) it is in a thread which is running the GMainContext that the task was started in, and (b) that GMainContext has run at least one iteration since the thread started (...) So if you have tasks that are returning immediately when they shouldn't be, figure out how it is that those conditions are coming to be true when you don't expect them to be)".

And that "If you are doing things like messing with the stack or calling setcontext(), then it's possible that could mess things up. I don't know."

Let's investigate how to fix the coroutines on our side and, later on, open a bug on GLib as well if that's the case.
Comment 1 Marc-Andre Lureau 2016-03-22 20:54:27 UTC
No conflict for me, the task GMainContext is the same (there is no thread etc). It makes sense that there has been further main loop iteration before the task returns. spicevmc want to return in idle, so the caller resumes in "main" coroutine context. I don't know what happens if you do the task return from the coroutine. Most likely, this ends in laster coroutine yields errors if the resume function do not deal well with coroutine contexts.
Comment 2 GitLab Migration User 2018-06-03 10:19:47 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/spice/spice-gtk/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.