forked from enlightenment/efl
From: 이병우 <bw80.lee@samsung.com>
I found a bug in ecore main loop while debuging cpu 100% issue on RSS application. 1. [RSS] RSS application register two io watch callbacks(for G_IO_IN, G_IO_OUT seperately) for a GIOChannel with g_io_add_watch(). 2. [ecore] In _ecore_glib_context_query() function, g_main_context_query() returns a fd list, and it has 2 fd items for the GIOChannel (channel id = 20). itr[0] (16, 1, 0) itr[1] (15, 1, 0) itr[2] (20, 1, 0) (G_IO_IN, 0) itr[3] (20, 4, 0) (G_IO_OUT, 0) itr[4] (18, 1, 0) 3. [ecore] In _ecore_glib_context_poll_from() function, create read, write, exception fd list according to the events flags of each fd item. [6 15 16 18 20], [20], [] 4. [ecore] in _ecore_glib_select__locked() function, get active fd number from select() call select(21, [6 15 16 18 20], [20], [], NULL) = 1 (out [20]) 5. [ecore] In _ecore_glib_context_poll_to() function, there is a bug on setting revents flag. (because of incorrect condition check - currently, the logic of the function cannot handle this case) itr[0] (16, 1, 0) itr[1] (15, 1, 0) itr[2] (20, 1, 4) (set incorrectly) itr[3] (20, 4, 0) => this should be set as (20, 4, 4)!!!! itr[4] (18, 1, 0) 6. [ecore] In _ecore_glib_select__locked(), g_main_context_check() function returns false because of the above bug, so g_main_context_dispatch() function will not be called. >> After this, the 2~6 flow is executed repeatedly on ecore main loop (because 20 out is still active fd) and this makes cpu 100% problem. SVN revision: 69739
This commit is contained in:
parent
f0792f360f
commit
707da8b620
|
@ -111,17 +111,17 @@ _ecore_glib_context_poll_to(GPollFD *pfds,
|
|||
for (; (itr < itr_end) && (ready > 0); itr++)
|
||||
{
|
||||
itr->revents = 0;
|
||||
if (FD_ISSET(itr->fd, rfds))
|
||||
if (FD_ISSET(itr->fd, rfds) && (itr->events & G_IO_IN))
|
||||
{
|
||||
itr->revents |= G_IO_IN;
|
||||
ready--;
|
||||
}
|
||||
if (FD_ISSET(itr->fd, wfds))
|
||||
if (FD_ISSET(itr->fd, wfds) && (itr->events & G_IO_OUT))
|
||||
{
|
||||
itr->revents |= G_IO_OUT;
|
||||
ready--;
|
||||
}
|
||||
if (FD_ISSET(itr->fd, efds))
|
||||
if (FD_ISSET(itr->fd, efds) && (itr->events & (G_IO_HUP | G_IO_ERR)))
|
||||
{
|
||||
itr->revents |= G_IO_ERR;
|
||||
ready--;
|
||||
|
|
Loading…
Reference in New Issue