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 application specific thread watchdog #1534

Merged
merged 1 commit into from
Sep 9, 2020

Conversation

jeandube
Copy link
Collaborator

@jeandube jeandube commented Sep 9, 2020

This fix sandwitches new blocking functions between THREAD_PAUSED/THREAD_RESUMED macros for application specific thread watchdog.
The application sets the SRT THREAD_XXX() macros to implement a thread watchdog. new blocking functions were added in the development toward 1.5.0 causing the thread watchdog to detect stalled threads that were legitimately blocked on event or timer and not gone wild in an infinite loop or slow callback.
By default the THREAD_XXX() macros are not defined so unless added in a multi-lines if or loop construction with no braces they can do no harm to most applications.

…macros for application specific thread watchdog.
@maxsharabayko maxsharabayko added this to the v1.5.0 - Sprint 23 milestone Sep 9, 2020
@maxsharabayko maxsharabayko added [core] Area: Changes in SRT library core Type: Maintenance Work required to maintain or clean up the code labels Sep 9, 2020
@maxsharabayko
Copy link
Collaborator

I wonder if placing the THREAD_PAUSED/THREAD_RESUMED calls inside wait_for is an option? It is possible for POSIX version. Or do you need to provide some reference to the place where the macro was called?

@ethouris
Copy link
Collaborator

ethouris commented Sep 9, 2020

Even better - as most of them rely on CSync, it has only one version, and could be placed inside. But I understand there was some reason to place these things also around whole loops that call the waiting function inside and then check a condition, not single waiting calls inside them.

Pity we can't have a version with lambda - this way the condition could be in the lambda and the loop inside.

@maxsharabayko maxsharabayko merged commit a95a6a4 into Haivision:master Sep 9, 2020
@maxsharabayko
Copy link
Collaborator

Comment from @jeandube

The THREAD macro records the position yes so when a thread block or go wild we know the last THREAD_XXX() crossed.

@jeandube jeandube deleted the fix-thread-watchdog branch September 14, 2020 11:50
@mbakholdina mbakholdina modified the milestones: v1.5.0 - Sprint 23, v1.4.2 Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[core] Area: Changes in SRT library core Type: Maintenance Work required to maintain or clean up the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants