Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Task Randomly Ended

Posted by qlab on August 8, 2017


We are using FreeRTOS 7.5.2 on STM32F4. And have run into a strange issue, that we cannot explain. Hope we can get some input.

We have had half a dozen boards running the software for over a month without any issues. Our application has several tasks running.

Few days ago we discovered that one of the boards "locked up". While looking into it, it appears that our main task was the only thing that froze (this controlled the keypad and LCD screen among other stuff, which is how we discovered it was frozen), the other tasks appear to be running OK.

We have been unable to reproduce this problem, we have tried using up all the stack and heap memory and those just caused Hardfaults and stack overflows (as expected).

Is it possible for a task to just end randomly? If so how? - We have While loops around all our tasks that should prevent them from exiting.

Any input at all will be very helpful.


Task Randomly Ended

Posted by rtel on August 8, 2017

Is it possible for a task to just end randomly?

Computers are not very good at doing things randomly...

If so how?

...but there can be differences in hardware.

I once had a support request that had the following report: There is something wrong with FreeRTOS. We have a very complex application that runs perfectly on all of our boards, except one, where it only runs for a few minutes.

Can you guess what the problem was? Are you seeing this symptom on one board only, or on multiple boards.

Consider using FreeRTOS+Trace (http://www.freertos.org/trace) with a circular trace buffer so you can view the last few seconds of execution before the system stopped.

Other than that, could be any number of things that don't normally show themselves until a whole set of scenarios co-incidentally present themselves at the same time, but nothing random. Are all your boards running the exact same version of FreeRTOS? Why such an old version? Newer versions, especially the head revision in the public SVN, have many more configASSERT() calls to check configuration and other set up.

Task Randomly Ended

Posted by qlab on August 9, 2017

Thanks for the feedback.

As far as versioning goes, we inherited this project. Which is the reason we are at such an old version of FreeRTOS. We are also shipping units, so upgrading the OS is not an option for us right now.

We have only experienced this issue on one board, after it was running for over 2 and half weeks. And obviously it appears "random" but I know it isn't truly random. I guess by random I meant, is there a scenario where FreeRTOS could terminate a task without an ASSERT? We have placed logic at all the different faults (Hard faults, Malloc Failed, Stack overflow etc.) that would shut off all the peripherals. In this failure mode, the peripherals kept running.

I know it is a long shot, as we are still trying to reproduce what happened. We are also checking the hardware to make sure there are no issues there.


Task Randomly Ended

Posted by rtel on August 9, 2017

Did the task still exist? If so, perhaps it was just deadlocked somehow.

Task Randomly Ended

Posted by gremond on August 30, 2017

Hi I have seen the same issue few times in my application, as I have a LCD when it is the LCD task it is easy to see that a task is missing. I have implement a PS command so when it happens, I juste send the PS command and I see that my task is no more in the list, but the total stack is still the same so the task has not been terminated properly.

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo & Nuvoton Cortex-M23 demo.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers





STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner