Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trickle.c can't work for multiple triggerings #15606

Closed
lingwei901011 opened this issue Apr 23, 2019 · 1 comment
Closed

trickle.c can't work for multiple triggerings #15606

lingwei901011 opened this issue Apr 23, 2019 · 1 comment
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug

Comments

@lingwei901011
Copy link
Contributor

lingwei901011 commented Apr 23, 2019

Describe the bug
in subsys/net/ip/trickle.c, the delayed work "trickle->timer" is initialized in net_trickle_start() at the first time to set its handler function as trickle_timeout(), in which the callback function we need will be invoked. Then, in the trickle_timeout(), the reschedule() will be called to re-schedule the next interval. in reschedule(), the SAME delayed work "trickle->timer" is initialized at the second time to change its handler function to double_interval_timeout(). However, when double_interval_timeout() is invoked, it calculates the next interval correctly and directly submits the delayed work BUT it doesn't re-change the SAME delayed work "trickle->timer" handler function to trickle_timeout(). so the delayed work's handler function is always the "double_interval_timeout()" and NEVER call the trickle_timeout() again and NEVER invoke the callback function we need again!.

Expected behavior
for multiple triggerings, we need re-initialize the SAME delayed work "trickle->timer" to change its handler function to trickle_timeout(). the modification is shown as follow:

static void double_interval_timeout(struct k_work *work)
{
           trickle->Istart = k_uptime_get_32() + rand_time;
   +++ k_delayed_wokr_init(&trickle->timer, trickle_timeout);
            k_delayed_work_submit(&trickle->timer, rand_time);
}

we have verified the modified trickle on our STM32F217ZG board.

Impact
the pre-version trickle timer can't trigger for multiple times.

Environment (please complete the following information):

  • OS: Linux Ubuntu
  • Toolchain: Zephyr SDK
  • master

please feel free to contact me if any questions

@lingwei901011 lingwei901011 added the bug The issue is a bug, or the PR is fixing a bug label Apr 23, 2019
@jukkar
Copy link
Member

jukkar commented Apr 23, 2019

Nice analysis. Could you send a PR that implements the fix you have in the comment?

lingwei901011 added a commit to lingwei901011/zephyr that referenced this issue Apr 24, 2019
lingwei901011 added a commit to lingwei901011/zephyr that referenced this issue Apr 24, 2019
fixed the issue zephyrproject-rtos#15606. for multiple triggerings, we need re-initialize
the delayed work "trickle->timer" to change its handler function to
trickle_timeout()

Signed-off-by: ling wei <[email protected]>
lingwei901011 added a commit to lingwei901011/zephyr that referenced this issue Apr 24, 2019
We need to re-initialize the trickle->timer delayed work to use
trickle_timeout() if there are multiple triggerings.

Fixes zephyrproject-rtos#15606

Signed-off-by: ling wei <[email protected]>
backporting bot pushed a commit that referenced this issue Apr 24, 2019
We need to re-initialize the trickle->timer delayed work to use
trickle_timeout() if there are multiple triggerings.

Fixes #15606

Signed-off-by: ling wei <[email protected]>
@jukkar jukkar closed this as completed in cdebd81 Apr 24, 2019
nashif pushed a commit that referenced this issue May 3, 2019
We need to re-initialize the trickle->timer delayed work to use
trickle_timeout() if there are multiple triggerings.

Fixes #15606

Signed-off-by: ling wei <[email protected]>
nashif pushed a commit to nashif/zephyr that referenced this issue May 7, 2019
We need to re-initialize the trickle->timer delayed work to use
trickle_timeout() if there are multiple triggerings.

Fixes zephyrproject-rtos#15606

Signed-off-by: ling wei <[email protected]>
nashif pushed a commit that referenced this issue May 7, 2019
We need to re-initialize the trickle->timer delayed work to use
trickle_timeout() if there are multiple triggerings.

Fixes #15606

Signed-off-by: ling wei <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

No branches or pull requests

2 participants