-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[tun_pkt]: Wait for AsyncSniffer to init fully #10346
Conversation
Signed-off-by: Lawrence Lee <[email protected]>
self.sniffer.start() | ||
|
||
while not hasattr(self.sniffer, 'stop_cb'): | ||
time.sleep(0.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, we can have a 1second wait here as 0.1 may be too aggressive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
/Azp run sonic.buildimage |
No pipelines are associated with this pull request. |
/Azp run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
/Azp run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
Fix for Tunnel packet handler can crash at system startup Signed-off-by: Lawrence Lee <[email protected]>
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
AsyncSniffer
object inititalizing fully. It is possible for a netlink message to arrive and trigger a sniffer restart prior to the sniffer initializing itsself.stop_cb
variable, 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_cb
doesn't exist yet.How I did it
After creating the sniffer object, block until the
self.stop_cb
attribute has been created.How to verify it
Run
sudo systemctl restart swss
and 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)