RedisPipeline ignore flush when call dtor from another thread.#736
Merged
liuh-80 merged 2 commits intosonic-net:masterfrom Jan 11, 2023
Merged
RedisPipeline ignore flush when call dtor from another thread.#736liuh-80 merged 2 commits intosonic-net:masterfrom
liuh-80 merged 2 commits intosonic-net:masterfrom
Conversation
liuh-80
commented
Jan 9, 2023
|
|
||
| #include "unistd.h" | ||
| #include "sys/syscall.h" | ||
| #define gettid() syscall(SYS_gettid) |
Contributor
Author
There was a problem hiding this comment.
there is no wrapper for gettid() in glibc <= 2.30, so we need use syscall(SYS_gettid)
qiluo-msft
reviewed
Jan 9, 2023
| { | ||
| // call flush from different thread will trigger race condition issue. | ||
| flush(); | ||
| } |
Contributor
qiluo-msft
reviewed
Jan 9, 2023
| initializeOwnerTid(); | ||
| } | ||
|
|
||
| ~RedisPipeline() { |
Contributor
Contributor
Author
There was a problem hiding this comment.
No, I check all dtor in swss-common only find RedisPipeline class run redis command in dtor.
qiluo-msft
approved these changes
Jan 11, 2023
Contributor
|
Do we need backport, for example to 202012 branch? |
arfeigin
pushed a commit
to arfeigin/sonic-swss-common
that referenced
this pull request
Jan 23, 2023
…-net#736) #### Why I did it Because RedisPipeline is not thread safe, in c++ if code call exit() from another thread, the dtor of RedisPipeline will be called from another thread and trigger a race condition issue. #### How I did it RedisPipeline ignore flush when call dtor from another thread. #### How to verify it Pass all UT and E2E test cases. #### Which release branch to backport (provide reason below if selected) <!-- - Note we only backport fixes to a release branch, *not* features! - Please also provide a reason for the backporting below. - e.g. - [x] 202006 --> - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [ ] 202111 #### Description for the changelog RedisPipeline ignore flush when call dtor from another thread. #### Link to config_db schema for YANG module changes <!-- Provide a link to config_db schema for the table for which YANG model is defined Link should point to correct section on https://github.com/Azure/SONiC/wiki/Configuration. --> #### A picture of a cute animal (not mandatory but encouraged)
dprital
added a commit
to dprital/sonic-buildimage
that referenced
this pull request
Jan 30, 2023
Update sonic-swss-common submodule pointer to include the following: * 6b6842a [NotificationProducer] add pipeline support ([sonic-net#708](sonic-net/sonic-swss-common#708)) * 2cb5ea0 Increase the netlink buffer size from 3MB to 16MB. ([sonic-net#739](sonic-net/sonic-swss-common#739)) * dacbdad RedisPipeline ignore flush when call dtor from another thread. ([sonic-net#736](sonic-net/sonic-swss-common#736)) Signed-off-by: dprital <drorp@nvidia.com>
8 tasks
liat-grozovik
pushed a commit
to sonic-net/sonic-buildimage
that referenced
this pull request
Feb 5, 2023
Update sonic-swss-common submodule pointer to include the following: * 6b6842a [NotificationProducer] add pipeline support ([#708](sonic-net/sonic-swss-common#708)) * 2cb5ea0 Increase the netlink buffer size from 3MB to 16MB. ([#739](sonic-net/sonic-swss-common#739)) * dacbdad RedisPipeline ignore flush when call dtor from another thread. ([#736](sonic-net/sonic-swss-common#736)) Signed-off-by: dprital <drorp@nvidia.com>
qiluo-msft
pushed a commit
that referenced
this pull request
Feb 10, 2023
#### Why I did it Because RedisPipeline is not thread safe, in c++ if code call exit() from another thread, the dtor of RedisPipeline will be called from another thread and trigger a race condition issue. #### How I did it RedisPipeline ignore flush when call dtor from another thread. #### How to verify it Pass all UT and E2E test cases. #### Which release branch to backport (provide reason below if selected) <!-- - Note we only backport fixes to a release branch, *not* features! - Please also provide a reason for the backporting below. - e.g. - [x] 202006 --> - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [ ] 202111 #### Description for the changelog RedisPipeline ignore flush when call dtor from another thread. #### Link to config_db schema for YANG module changes <!-- Provide a link to config_db schema for the table for which YANG model is defined Link should point to correct section on https://github.com/Azure/SONiC/wiki/Configuration. --> #### A picture of a cute animal (not mandatory but encouraged)
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.
Why I did it
Because RedisPipeline is not thread safe, in c++ if code call exit() from another thread, the dtor of RedisPipeline will be called from another thread and trigger a race condition issue.
How I did it
RedisPipeline ignore flush when call dtor from another thread.
How to verify it
Pass all UT and E2E test cases.
Which release branch to backport (provide reason below if selected)
Description for the changelog
RedisPipeline ignore flush when call dtor from another thread.
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)