Conversation
Author
|
It is reimplementation of the PR from #1408 where I added the environmental variable: WEBKIT_WPE_BMALLOC_MICROSECONDS_SLEEP which can be used to set how many microseconds we use in case of usleep, if WEBKIT_WPE_BMALLOC_MICROSECONDS_SLEEP is not set or set to 0 than old implementation (sched_yield) will be used. |
To enable the usleep you need to set environmental variable WEBKIT_WPE_BMALLOC_MICROSECONDS_SLEEP (microseconds of sleep). When real time (RT) thread priorities are used for some of the gstreamer pipeline elements, we may run into a situation where several RT threads start spinning during a mutex acquisition process, leading to a system hang as most other threads won't be able to run. Sequence of events leading up to the hang: 1. A web process thread acquires the mutex lock for the heap and is then involuntary descheduled, and does not run again 2. vqueue:src (RT priority) enters the lockSlowCase and starts spinning in the while loop 3. multiqueue0:src (instance 1, RT priority) enters the lockSlowCase and starts spinning in the while loop 4. aqueue:src (RT priority) enters the lockSlowCase and starts spinning in the while loop 5. multiqueue0:src (instance 2, RT priority) enters the lockSlowCase and starts spinning in the while loop Once stage 5 is hit, the box is hung as the only thing that can run on a CPU core is: 1. one of the above RT threads (aqueue, vqueue, or multiqueue) 2. any other RT thread with a priority equal or greater than the above RT threads 3. any h/w irq The use of the usleep() will allow the low priority process to run and release the mutex lock, avoiding the hang Author of issue analysis and fix proposal: Steven Webster. * Source/bmalloc/bmalloc/Mutex.cpp: (bmalloc::yield):
ed956e9 to
8782ef0
Compare
magomez
approved these changes
Dec 11, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To enable the usleep you need to set environmental variable WEBKIT_WPE_BMALLOC_MICROSECONDS_SLEEP (microseconds of sleep).
When real time (RT) thread priorities are used for some of the gstreamer pipeline elements, we may run into a situation where several RT threads start spinning during a mutex acquisition process, leading to a system hang as most other threads won't be able to run.
Sequence of events leading up to the hang:
Once stage 5 is hit, the box is hung as the only thing that can run on a CPU core is:
The use of the usleep() will allow the low priority process to run and release the mutex lock, avoiding the hang
Author of issue analysis and fix proposal: Steven Webster.
(bmalloc::yield):
8782ef0