Queue deletion hangs: SOLVED!

Gabriel Raineri graineri at invap.com.ar
Fri Nov 11 13:10:23 UTC 2011


I have managed to get to the root of the matter...

The thing is, as you may expect... silly. :S

TASK A: Task waiting at the queue. Priority: X
TASK B: Task deleting the queue. Priority: X + 1

Task A has a infinite loop, sort of:
while (TRUE)
{
     if (rtems_message_queue_receive(...) == RTEMS_SUCCESSFUL)
     {
          // Stuff
     }
}

So, when TASK B deletes the queue, there is context switch and the CPU 
is taken over by TASK A which will not yield the processor since the 
call to rtems_message_queue_receive is no longer blocking.

End of the issue. =)

Thanks a lot!

Cheers,
Gabriel

On 11-Nov-11 8:47 AM, Gabriel Raineri wrote:
> Well, I wasn't able to figure out why the task hangs when its priority 
> is lower than the one waiting at the queue.
>
> Providing you with a Test Case may take some time. So, I will try some 
> other ideas in mind and if that doesn't solve the problem, I guess I 
> will leave it for later.
>
> Thanks!
>
>
> On 10-Nov-11 11:32 AM, Gabriel Raineri wrote:
>> Quick update!
>>
>> If I raise the priority of the task deleting the queue to be higher 
>> than the one waiting, it works correctly.
>>
>> I'll keep you posted.
>>
>> Thanks!
>>
>> On 10-Nov-11 10:33 AM, Gabriel Raineri wrote:
>>> Actually, I don't have a test case. However, I will try to write one 
>>> to see if I can repeat the issue.
>>>
>>> Sorry, the RTEMS version is: 4.9.99.0
>>>
>>> Thanks again!
>>>
>>> On 10-Nov-11 10:25 AM, Joel Sherrill wrote:
>>>> On 11/10/2011 07:11 AM, Gabriel Raineri wrote:
>>>>> Hi everybody!
>>>>>
>>>>> I'm having an issue while deleting a queue: the call to 
>>>>> rtems_message_queue_delete hangs.
>>>>> I have been debugging RTEMS code and I found that it gets stuck at 
>>>>> _Thread_Enable_dispatch() in msgqdelete.c
>>>>>
>>>> Do you have a test case?  This case is covered in the test suite
>>>> so there must be something different about your case.
>>>>> More details:
>>>>> - RTEMS Version: 4.99
>>>> That's not an RTEMS version number.  What version are you using?
>>>> How did you get it?
>>>>> - The task that deletes the queue is not the one that created it.
>>>>> - There is a task blocked waiting for the queue which has a higher 
>>>>> priority than the task deleting the queue.
>>>>> - I have also tried disabling interrupts before the deletion in 
>>>>> order to avoid context switching with no luck (still hangs).
>>>>> - There are no pending messages on the queue.
>>>>> - All nodes are LOCAL.
>>>>>
>>>>> You might be wondering why in the world I'm trying to delete a 
>>>>> queue. Well, to make a long story short, the idea behind this is 
>>>>> to inject errors into our application to see if it is reacting as 
>>>>> expected.
>>>>>
>>>>> Any help will be appreciated!
>>>>>
>>>>> Thanks in advance!
>>>>>
>>>>> Cheers,
>>>>> Gabriel
>>>>>
>>>>
>>>>
>>>
>>>
>>> _______________________________________________
>>> rtems-users mailing list
>>> rtems-users at rtems.org
>>> http://www.rtems.org/mailman/listinfo/rtems-users
>>
>>
>> _______________________________________________
>> rtems-users mailing list
>> rtems-users at rtems.org
>> http://www.rtems.org/mailman/listinfo/rtems-users
>
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20111111/e073901e/attachment-0001.html>


More information about the users mailing list