-
Notifications
You must be signed in to change notification settings - Fork 545
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
Add a delay between killing teamd processes #3325
base: master
Are you sure you want to change the base?
Conversation
When killing 10 or more teamd processes, add a delay of 0.1 seconds after every 10 kill signals/proceses. This is because in the LAG scale tests (in `ecmp/inner_hashing/test_inner_hashing_lag.py` in sonic-mgmt), it may create 100 LAGs, and when destroying them all, some of those LAGs may fail to be properly destroyed, leaving some stale port channels around. This seems to be because the netlink socket buffers on which the teamd processes get notifications become full with events of the other port channels/interfaces going down. As a workaround, add some delays in killing the teamd processes, so that the netlink buffers don't become full, causing messages to get dropped. This delay was randomly chosen, and it seems to work well with 100 LAGs on a KVM. It can probably made to be a bit more aggressive if needed (i.e. maybe 0.05 seconds every 20 processes). Signed-off-by: Saikrishna Arcot <[email protected]>
Signed-off-by: Saikrishna Arcot <[email protected]>
This requires overriding some libc functions and capturing information about kill signals sent or intercepting file open operations. Signe -off-by: Saikrishna Arcot <[email protected]>
/azpw run |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
Comparing the time needed to send SIGTERM to the teamd processes before and after this change, it appears that the time is roughly the same for about 70 LAGs, as tested on a physical device. Before:
After:
In both cases, for 70 LAGs, it took about 0.6-0.7 seconds to send SIGTERM to the teamd processes, but the distribution of SIGTERMs sent is different. However, on this device, there are still some netlink messages getting dropped resulting in the cleanup not being complete. |
@saiarcot895 Can you please run your changes with test_po_cleanup and test_po_cleanup_after_reload? We are noticing these tests statically fail with your changes |
100ms might not be enough on slow systems for the teamd shutdown sequence to actually be staggered. Signed-off-by: Saikrishna Arcot <[email protected]>
… into teamd-delay-kill
@saiarcot895 Do we have an updated fix? |
Updated syslog after changes:
SIGTERM signal to the teamd supervisord was sent at 07:41:40, and the container exited at 07:41:46. Teamd container is also configured to have a 60-second wait time (instead of the 10-second wait time) for termination, meaning docker will wait 60 seconds for the container to go down before forcefully killing it. This means that a 6-second wait time here is fine. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
cfgmgr/teammgr.cpp
Outdated
pid_t pid; | ||
if (++sleepCounter % 10 == 0) { | ||
// Sleep for 100 milliseconds so as to not overwhelm the netlink |
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.
Do we need to change comment .. is it 100ms or 200ms
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.
Also instead of giving a one shot 200ms delay .. can we put 10ms for each delete ? The issues we have seen before is when we delete a large number of Portchannels few stale remains.
So now here you are optimizing the call from shell/cmd approach to system_call() approach which will make it execute faster
I felt the older shell/cmd way of checking for pid/kill was introducing some delay which helped in the cleanup of portchannels.
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.
Tried a 10ms delay, and this seems to work well, at least on Arista 7260cx3.
Signed-off-by: Saikrishna Arcot <[email protected]>
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
What I did
When killing 10 or more teamd processes, add a delay of 0.1 seconds after every 10 kill signals/proceses. This is because in the LAG scale tests (in
ecmp/inner_hashing/test_inner_hashing_lag.py
in sonic-mgmt), it may create 100 LAGs, and when destroying them all, some of those LAGs may fail to be properly destroyed, leaving some stale port channels around. This seems to be because the netlink socket buffers on which the teamd processes get notifications become full with events of the other port channels/interfaces going downWhy I did it
As a workaround, add some delays in killing the teamd processes, so that the netlink buffers don't become full, causing messages to get dropped.
This delay was randomly chosen, and it seems to work well with 100 LAGs on a KVM. It can probably made to be a bit more aggressive if needed (i.e. maybe 0.05 seconds every 20 processes).
How I verified it
On a KVM testbed with t0-116 topology with a bit more than 100 LAGs, stop teamd using
sudo systemctl stop teamd
, and verify that all of the LAGs were deleted, and there were no messages from the kernel similar to the following:Details if related
Partial fix for sonic-net/sonic-buildimage#19310.