-
Notifications
You must be signed in to change notification settings - Fork 123
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
Part 10 deadlock demo timeout solution: tasks attempt to give/return mutexes that have never been taken #5
Comments
Apologies for the super long delay. I'm just now getting a chance to go through emails and GitHub issues. Thank you for the fix! I'd like to keep the demos used in the video exactly as they appear in the video (if possible). I don't remember running into the reset issue on my ESP32 in the deadlock timeout demo. Do you have any idea why it was happening for you? |
Honestly, I can't say I remember as of now 🤦. Looking back at it now, I'm pretty sure the only change I ended up making from your stock solution was to move the I don't have the time to try and re-run through my debugging steps right now, but I think this still makes sense from a theoretical perspective. Looking at the serial output and original code, Task A attempts to give Although, I may very well be missing something important here. For reference, my version of the tutorial is in my repository here: github.com/neilbalch/ESP32-FreeRTOS-Tutorial |
Interesting! I thought that in FreeRTOS, if you "gave" a mutex that had not been taken, nothing would happen. That's the behavior I saw in my example, but it looks like you're seeing resets. From what I can tell, your resets are happening because of a stack overflow (Task A is filling up the allocated stack to the point the canary watchpoint is tripped). Does the reset happen right away, or does it take some time to occur when you run the program? Did you change anything else other than moving the |
If I remember correctly, and based on the serial output I provided in the original issue text, the resets started occurring immediately after an MCU reset/program cycle. I can't remember how or why, but I thought I originally attributed that reset exception message to the task being in a permanently blocked state as it waited for the mutex to be "given," but your explanation now seems more proper. As for a list of changes, I believe the only thing I did was move the mutex give instructions. The full code I used is in my repo here. |
I also have the same problem, my board is esp32-s3. |
I noticed while going through this (excellent BTW!) tutorial series that the ESP32 was resetting repeatedly during the execution of the deadlock demo timeout solution.
Serial output:
As opposed to what's in this repo, I realized that this version of the function is required to avoid the core reset: (same change for Task B as well)
I can submit a PR to fix this if you're interested? Love your work here, Shawn!
The text was updated successfully, but these errors were encountered: