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

lwIP mbox synchronization issue #5380

Open
pillip8282 opened this issue Dec 22, 2021 · 0 comments
Open

lwIP mbox synchronization issue #5380

pillip8282 opened this issue Dec 22, 2021 · 0 comments

Comments

@pillip8282
Copy link
Contributor

lwIP mbox synchronization issue

Description

mbox uses wait_send and wait_fetch to check that there is task which waits an event. It doesn't occur often, but problems can arise in special scenario.

Procedure

  1. Task A tried to fetch an data from mbox with timeout
  2. If mbox is empty then Task A increase wait_fetch with mutex protection
  3. Task A releases mutex and sys_arch_sem_wait(mail, timeout) to get an event.
  4. Time expires and task A exit from sys_arch_sem_wait()
  5. Context switching occurs, Task B post event with sys_arch_mbox_post()
  6. After task B enque data to mbox, it'll check whether send an event or not
  7. Task B sends an event because mbox was empty(first_msg == 1) and wait_fetch is not 0.
  8. After context switching task A lock mutex and decrease wait_fetch and exit the function.
  9. No task receive the event task B sent, so unexpected behavior can be happened.
pillip8282 added a commit to pillip8282/TizenRT that referenced this issue Jan 4, 2022
The commit played the issue reported to
Samsung#5380. The patch should pass
the testcase in mbox_sync.c
an4967 pushed a commit that referenced this issue Jan 4, 2022
The commit played the issue reported to
#5380. The patch should pass
the testcase in mbox_sync.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant