Bug: xTimerIsTimerActive() is returning wrong value v10.3.0

When timer is started for short period of time e.g. 1ms then callback function is called from below code (timer.c l.810).:

		switch( xMessage.xMessageID )
			case tmrCOMMAND_START :
			case tmrCOMMAND_RESET :
				/* Start or restart a timer. */
				pxTimer->ucStatus |= tmrSTATUS_IS_ACTIVE;
				if( prvInsertTimerInActiveList( pxTimer,  xMessage.u.xTimerParameters.xMessageValue + pxTimer->xTimerPeriodInTicks, xTimeNow, xMessage.u.xTimerParameters.xMessageValue ) != pdFALSE )
					/* The timer expired before it was added to the active
					timer list.  Process it now. */
					pxTimer->pxCallbackFunction( ( TimerHandle_t ) pxTimer );

In my case in callback function I’m checking if timer is active or not by calling API xTimerIsTimerActive() and it is returning wrong value. I need correct information to run proper action and this action depends if timer is running in autoreload or one shot mode.

Thanks for this report, but we are going to need more information to investigate. For example:

When you check the timer’s active state from a timer callback function, is the timer callback function you are in the one for the timer you are checking, or are you checking a different timer?

Is the timer you are checking a one shot or autoreload timer?

What value is xTimerIsTimerActive() returning, and what value do you expect it to return?

Would this function (which is new) be useful to you? https://www.freertos.org/uxTimerGetReloadMode.html

Hi Richard,

My answers:
The callback function is ‘this’ timer callback.
The timer is one shot timer
According to documentation timer is dormant if it expired and is one shot so I expected pdFALSE

Probably https://www.freertos.org/uxTimerGetReloadMode.html will solve the issue but i’m using xTimerIsTimerActive() also in other components and would like to be sure that return value is correct.

The problem wasn’t present in v10.0.1. I run diff on timer.c and several changes were provided a specially line pxTimer->ucStatus |= tmrSTATUS_IS_ACTIVE was added