Brian Wang | 7 Aug 2012 03:18
Picon

[E-devel] Possible Unmatched LKL and LKU in _ecore_thread_shutdown

Hello all,

In ecore_thread.c:_ecore_thread_shutdown(),
   if there is still some _ecore_running_job,
   ecore_thread_cancel() will be called while
_ecore_pending_job_threads_mutex is being held.
In ecore_thread_cancel(),
   it will try to acquire the same mutex, causing
_ecore_thread_shutdown() to freeze.

That's how I read the code while I was trying to debug why my app does
not shutdown completely (there
is a thread running, without being cancelled before calling elm_exit()).

I do not know how to fix it other than moving LKU before calling
ecore_thread_cancel; however, I do not know
if it's safe to do or not.

Thanks in advance.

brian

--

-- 
brian
------------------

Cool-Karaoke - The smallest recording studio, in your palm, open-sourced
http://cool-idea.com.tw/

iMaGiNaTiOn iS mOrE iMpOrTaNt tHaN kNoWlEdGe
(Continue reading)

Cedric BAIL | 7 Aug 2012 04:28
Picon
Favicon

Re: [E-devel] Possible Unmatched LKL and LKU in _ecore_thread_shutdown

Hello,

On Tue, Aug 7, 2012 at 10:18 AM, Brian Wang <brian.wang.0721 <at> gmail.com> wrote:
> In ecore_thread.c:_ecore_thread_shutdown(),
>    if there is still some _ecore_running_job,
>    ecore_thread_cancel() will be called while
> _ecore_pending_job_threads_mutex is being held.
> In ecore_thread_cancel(),
>    it will try to acquire the same mutex, causing
> _ecore_thread_shutdown() to freeze.
>
> That's how I read the code while I was trying to debug why my app does
> not shutdown completely (there
> is a thread running, without being cancelled before calling elm_exit()).
>
> I do not know how to fix it other than moving LKU before calling
> ecore_thread_cancel; however, I do not know
> if it's safe to do or not.

Sadly, it is not as we need to take lock as long as we walk on that
list. I will look at it and find a proper solution, but basically
ecore_thread_cancel doesn't access the same list. So either I use
another lock when accessing the _ecore_running_job or I tell somehow
ecore_thread_cancel to not even try to access the
_ecore_pending_job_threads and _ecore_pending_job_threads_feedback.
Need to think, quickly, about it. I need to fix that before EFL
release.

Thanks for the bug report.
--

-- 
(Continue reading)

Cedric BAIL | 7 Aug 2012 05:47
Picon
Favicon

Re: [E-devel] Possible Unmatched LKL and LKU in _ecore_thread_shutdown

On Tue, Aug 7, 2012 at 11:28 AM, Cedric BAIL <cedric.bail <at> free.fr> wrote:
> On Tue, Aug 7, 2012 at 10:18 AM, Brian Wang <brian.wang.0721 <at> gmail.com> wrote:
>> In ecore_thread.c:_ecore_thread_shutdown(),
>>    if there is still some _ecore_running_job,
>>    ecore_thread_cancel() will be called while
>> _ecore_pending_job_threads_mutex is being held.
>> In ecore_thread_cancel(),
>>    it will try to acquire the same mutex, causing
>> _ecore_thread_shutdown() to freeze.
>>
>> That's how I read the code while I was trying to debug why my app does
>> not shutdown completely (there
>> is a thread running, without being cancelled before calling elm_exit()).
>>
>> I do not know how to fix it other than moving LKU before calling
>> ecore_thread_cancel; however, I do not know
>> if it's safe to do or not.
>
> Sadly, it is not as we need to take lock as long as we walk on that
> list. I will look at it and find a proper solution, but basically
> ecore_thread_cancel doesn't access the same list. So either I use
> another lock when accessing the _ecore_running_job or I tell somehow
> ecore_thread_cancel to not even try to access the
> _ecore_pending_job_threads and _ecore_pending_job_threads_feedback.
> Need to think, quickly, about it. I need to fix that before EFL
> release.

Ok, fixed in r74953 by using another mutex.
--

-- 
Cedric BAIL
(Continue reading)

Brian Wang | 7 Aug 2012 05:54
Picon

Re: [E-devel] Possible Unmatched LKL and LKU in _ecore_thread_shutdown

On Tue, Aug 7, 2012 at 11:47 AM, Cedric BAIL <cedric.bail <at> free.fr> wrote:
> On Tue, Aug 7, 2012 at 11:28 AM, Cedric BAIL <cedric.bail <at> free.fr> wrote:
>> On Tue, Aug 7, 2012 at 10:18 AM, Brian Wang <brian.wang.0721 <at> gmail.com> wrote:
>>> In ecore_thread.c:_ecore_thread_shutdown(),
>>>    if there is still some _ecore_running_job,
>>>    ecore_thread_cancel() will be called while
>>> _ecore_pending_job_threads_mutex is being held.
>>> In ecore_thread_cancel(),
>>>    it will try to acquire the same mutex, causing
>>> _ecore_thread_shutdown() to freeze.
>>>
>>> That's how I read the code while I was trying to debug why my app does
>>> not shutdown completely (there
>>> is a thread running, without being cancelled before calling elm_exit()).
>>>
>>> I do not know how to fix it other than moving LKU before calling
>>> ecore_thread_cancel; however, I do not know
>>> if it's safe to do or not.
>>
>> Sadly, it is not as we need to take lock as long as we walk on that
>> list. I will look at it and find a proper solution, but basically
>> ecore_thread_cancel doesn't access the same list. So either I use
>> another lock when accessing the _ecore_running_job or I tell somehow
>> ecore_thread_cancel to not even try to access the
>> _ecore_pending_job_threads and _ecore_pending_job_threads_feedback.
>> Need to think, quickly, about it. I need to fix that before EFL
>> release.
>
> Ok, fixed in r74953 by using another mutex.

(Continue reading)


Gmane