[tun_pkt]: Wait for AsyncSniffer to init fully#10346
Merged
prsunny merged 1 commit intosonic-net:masterfrom Mar 30, 2022
Merged
[tun_pkt]: Wait for AsyncSniffer to init fully#10346prsunny merged 1 commit intosonic-net:masterfrom
prsunny merged 1 commit intosonic-net:masterfrom
Conversation
Signed-off-by: Lawrence Lee <[email protected]>
prsunny
reviewed
Mar 25, 2022
| self.sniffer.start() | ||
|
|
||
| while not hasattr(self.sniffer, 'stop_cb'): | ||
| time.sleep(0.1) |
Contributor
There was a problem hiding this comment.
I think, we can have a 1second wait here as 0.1 may be too aggressive
Contributor
Author
There was a problem hiding this comment.
Did some testing, it looks like it takes about 0.2 seconds to initialize, might be ok to keep 0.1 seconds so we can start the service ASAP?
5 tasks
Contributor
Author
|
/Azp run sonic.buildimage |
|
No pipelines are associated with this pull request. |
Contributor
Author
|
/Azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
prsunny
approved these changes
Mar 29, 2022
Contributor
Author
|
/Azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
qiluo-msft
pushed a commit
that referenced
this pull request
Mar 30, 2022
Fix for Tunnel packet handler can crash at system startup Signed-off-by: Lawrence Lee <[email protected]>
liushilongbuaa
pushed a commit
to liushilongbuaa/sonic-buildimage
that referenced
this pull request
Jun 10, 2022
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.
Signed-off-by: Lawrence Lee [email protected]
Why I did it
Tunnel packet handler can crash at system startup:
This is due to a race condition between netlink messages being sent by the kernel and the
AsyncSnifferobject inititalizing fully. It is possible for a netlink message to arrive and trigger a sniffer restart prior to the sniffer initializing itsself.stop_cbvariable, since the variable creation happens during the sniffer startup rather than during the creation of the sniffer object. If this occurs, the tunnel_packet_handler attempts to stop the sniffer, but this operation fails becauseself.stop_cbdoesn't exist yet.How I did it
After creating the sniffer object, block until the
self.stop_cbattribute has been created.How to verify it
Run
sudo systemctl restart swssand verify the tunnel packet handler does not crashWhich release branch to backport (provide reason below if selected)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)