-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
When schedule many Tickers one after the other with the same time interval 100ms and then wait 105ms it's expected that after this time all Tickers will be fired once. But we get other results sometimes not all tickers are fired and sometimes some fire more then once
Problem noticed in #5261 in the following test
/** Test many tickers run one after the other
Given many Tickers
When schedule them one after the other with the same time intervals
Then tickers properly execute callbacks
When schedule them one after the other with the different time intervals
Then tickers properly execute callbacks
*/
void test_multi_ticker(void)
Sample code for reproduction
#define MULTI_TICKER_TIME_MS 100
#define TICKER_COUNT 16
Ticker ticker[TICKER_COUNT];
uint32_t multi_counter;
void increment_multi_counter(void)
{
core_util_atomic_incr_u32(&multi_counter, 1);
}
const uint32_t extra_wait = 5; // extra 5ms wait time
multi_counter = 0;
for (int i = 0; i < TICKER_COUNT; i++) {
ticker[i].attach_us(callback(increment_multi_counter), MULTI_TICKER_TIME_MS * 1000);
}
Thread::wait(MULTI_TICKER_TIME_MS + extra_wait);
for (int i = 0; i < TICKER_COUNT; i++) {
ticker[i].detach();
}
TEST_ASSERT_EQUAL(TICKER_COUNT, multi_counter);
Description
- Type: Bug
- Related PR: Extends test set for Ticker class #5261
- Related Issues: KL46Z: Inconsistent Ticker callback calls when scheduled many tickers at the same time #5564 MAX32630 MAX32625: Program hangs when scheduled many tickers one after the other with the same time interval #5309
- Priority: Major
Bug
Target
NCS36510
Toolchain:
GCC_ARM|ARM|IAR
mbed-os sha:
master
Expected behavior
Ticker callback is executed exactly 16 times
Actual behavior
Ticker callback is executed several times 3, 7, 10, 32 but not as expected