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

[Bug] Lease task creates a busy loop on ESP32 #846

Closed
vortex314 opened this issue Dec 29, 2024 · 4 comments
Closed

[Bug] Lease task creates a busy loop on ESP32 #846

vortex314 opened this issue Dec 29, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@vortex314
Copy link
Contributor

Describe the bug

When the freeRTOS ticks/sec is at 100 ( the default value ), the z_sleep_ms doesn´t suspend the thread and creates starvation for the other threads

z_result_t z_sleep_ms(size_t time) {
    z_time_t start = z_time_now();

    // Most sleep APIs promise to sleep at least whatever you asked them to.
    // This may compound, so this approach may make sleeps longer than expected.
    // This extra check tries to minimize the amount of extra time it might sleep.
    while (z_time_elapsed_ms(&start) < time) {
        vTaskDelay(1 / portTICK_PERIOD_MS);   // the argument becomes 0. 
    }

    return 0;
}

should be replaced with

z_result_t z_sleep_ms(size_t time) {
    vTaskDelay ( time / portTICK_PERIOD_MS == 0 ? 1 : time / portTICK_PERIOD_MS );
    return 0;

}

To reproduce

Use sample p_sub sources for espidf

System info

Any ESP32 with ESPIDF

@vortex314 vortex314 added the bug Something isn't working label Dec 29, 2024
@vortex314
Copy link
Contributor Author

Before
image
After
image

@vortex314
Copy link
Contributor Author

@Mallets
Copy link
Member

Mallets commented Jan 6, 2025

#848 has been merged. Closing the issue. Feel free to re-open it if the problem still persists.

@Mallets Mallets closed this as completed Jan 6, 2025
@vortex314
Copy link
Contributor Author

@sashacmc @Mallets Thank you all for the quick follow-up. Great product and development !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants