This repository was archived by the owner on Jul 29, 2024. It is now read-only.
Shutdown threads in a graceful way#270
Merged
Merged
Conversation
Signed-off-by: Jing Li <jing.b.li@intel.com>
Austin-Hu
added a commit
to Austin-Hu/SVT-HEVC
that referenced
this pull request
Nov 5, 2019
(When receiving only 1 frame input, )SvtHevcEncApp or any application
may invokes EbDeinitEncoder() ahead of all the kernel threads complete
processing. And EbDeinitEncoder() would free all the recorded memory
objects which may be still used by some threads, so that race condition
happens.
So fixed (worked around) this issue by terminating the kernel threads
before freeing memories. Ideally, there should be some object reference
and unreference mechanism to make the objects access safe.
Note:
1. EbObjectIncLiveCount() couldn't be helpful to address such race
condition, because it just avoids that an EbObjectWrapper_t object
wouldn't be returned back to an empty queue prematurely;
2. EB_SEND_END_OBJ() plus EB_CHECK_END_OBJ() (induced in PR OpenVisualCloud#270) could
not avoid such race condition, either. Because the objects can be
freed at any moment when a kernel thread is running and needs to
access to it.
Signed-off-by: Austin Hu <austin.hu@intel.com>
This was referenced Nov 5, 2019
tianjunwork
pushed a commit
that referenced
this pull request
Nov 12, 2019
(When receiving only 1 frame input) SvtHevcEncApp or any application
may invokes EbDeinitEncoder() ahead of all the kernel threads complete
processing. And EbDeinitEncoder() would free all the recorded memory
objects which may be still used by some threads, so that race condition
happens.
So fixed (worked around) this issue by terminating the kernel threads
before freeing memories. Ideally, there should be some object reference
and unreference mechanism to make the objects access safe.
Note:
1. EbObjectIncLiveCount() couldn't be helpful to address such race
condition, because it just avoids that an EbObjectWrapper_t object
wouldn't be returned back to an empty queue prematurely;
2. EB_SEND_END_OBJ() plus EB_CHECK_END_OBJ() (induced in PR #270) could
not avoid such race condition, either. Because the objects can be
freed at any moment when a kernel thread is running and needs to
access to it.
Signed-off-by: Austin Hu <austin.hu@intel.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Signed-off-by: Jing Li jing.b.li@intel.com