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

Fix deadlock when a lot of notifications are received in a very short time span #1911

Merged
merged 1 commit into from
Nov 19, 2023

Conversation

JF002
Copy link
Collaborator

@JF002 JF002 commented Nov 12, 2023

When a notification is received, SystemTask sends messages to DisplayApp, which loads the Notifications apps that sends a few messages to SystemApp. When notification are received too quickly, DisplayApp and SystemTask cannot process those messages fast enough (probably because of the time it takes to refresh the display) and the message queues fill up. When they are full, the current implementation just waits until there's room available to store the event. In this case, since both tasks exchange messages, they end up in a deadlock.

This fix consists in setting the timeout value to 0 (non-blocking mode) for the NewNotification messages on the DisplayApp side. This will prevent the SystemTask from being blocked (which would result in the watchdog reseting the watch). A more generic approach should be design in the future.

Fixes #1888

Copy link

Build size and comparison to main:

Section Size Difference
text 377512B 0B
data 940B 0B
bss 63420B 0B

… time span.

When a notification is received, SystemTask sends messages to DisplayApp, which loads the Notifications apps that sends a few messages to SystemApp.
When notification are received too quickly, DisplayApp and SystemTask cannot process those messages fast enough (probably because of the time it takes to refresh the display) and the message queues fill up. When they are full, the current implementation just waits until there's room available to store the event. In this case, since both tasks exchange messages, they end up in a deadlock.

This fix consists in setting the timeout value to 0 (non-blocking mode) for the NewNotification messages on the DisplayApp side. This will prevent the SystemTask from being blocked (which would result in the watchdog reseting the watch). A more generic approach should be design in the future.
@JF002 JF002 force-pushed the fix-deadlock-fast-notifications branch from 993d697 to c309488 Compare November 12, 2023 18:46
@FintasticMan FintasticMan added the bug Something isn't working label Nov 16, 2023
@JF002 JF002 added this to the 1.14.0 milestone Nov 19, 2023
@JF002 JF002 merged commit f6d7f60 into main Nov 19, 2023
7 checks passed
@FintasticMan FintasticMan deleted the fix-deadlock-fast-notifications branch December 10, 2023 20:45
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

Successfully merging this pull request may close these issues.

Recieving many notifications in a short time span causes the watch to get soft bricked
2 participants