-
Notifications
You must be signed in to change notification settings - Fork 87
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 and auto-reconnect not working properly in FreeRTOS platform #865
Comments
Dear @pdematteis, This is a known limitation of the connection recovery mechanism. |
There is also another annoying side effect of using auto-reconnect, at least in my implementation. I finally found a good solution by using this cleanup function:
with a support task performing a loop like:
where Thanks. |
Dear @pdematteis If it's not too much trouble, please check this solution for your specific case. The problem that it is impossible to send messages (as well as asserts) during a restart remains at the moment, this is the expected behavior. The main thing is that the system does not crash or hangs. There are also plans to create an API for notification of connection loss, but I have no deadlines for its implementation. |
Hello @sashacmc The overall cleanup stuff looks good.
Dropping the transport in the lease task without reconnecting, makes things tricky while trying to cleanup from the main task. |
Describe the bug
The current lease implementation, when an error occurs, calls
_z_unicast_transport_clear()
, that in turn calls_z_task_detach()
.In FreeRTOS, it finally calls
vTaskDelete()
, which imply that the task is immediately cancelled and does not continue; cleanup code is never reached, as well as auto-reconnect code.A cleaner solution, according to me, is just to set
ztu->_common._lease_task_running = false
, then deal with cleanup and reconnection from another task.As a side note, auto-reconnect from within the lease task, also causes a second lease task to be started in parallel. It uses too much heap in FreeRTOS and can't use static tasks allocation, because the same buffer would be used by the two lease tasks concurrently.
To reproduce
.
System info
.
The text was updated successfully, but these errors were encountered: