netbird
netbird copied to clipboard
Debounce network changes
Describe your changes
Block restarting netbird engine for 3s when network change detected. This will help prevent Netbird from attempting to create multiple wiregurad interfaces when restarting the engine in rapid succession
Issue ticket number and link
#2196 #2130
Checklist
- [x] Is it a bug fix
- [ ] Is a typo/documentation fix
- [ ] Is a feature enhancement
- [ ] It is a refactor
- [ ] Created tests that fail without the change (if possible)
- [ ] Extended the README / documentation, if necessary
Please feel free to make changes as you fit
@hurricanehrndz Thank you for the PR! I have a question. You made a new, custom struct for locking the time value. In your change, you are doing multiple operations under the locked state. I am not sure if that is necessary or not. If not then it could be better to use an atomic store. The atomic provides options to store value in atomic way. https://pkg.go.dev/sync/atomic
@hurricanehrndz Thank you for the PR! I have a question. You made a new, custom struct for locking the time value. In your change, you are doing multiple operations under the locked state. I am not sure if that is necessary or not. If not then it could be better to use an atomic store. The atomic provides options to store value in atomic way. https://pkg.go.dev/sync/atomic
I think it is necessary because the bug is caused by a race condition. When a device has multiple network interfaces all with a default route to the internet, the callback function will be called multiple times simultaneously.
Hi @hurricanehrndz,
we want to go with a slightly different solution that doesn't ignore potential changes for 3 seconds. I'll close this PR and create a new one. Thank you for bringing the issue to our attention and the inspiration.
Please tag me on the new PR and I can test it for you.
Get Outlook for iOShttps://aka.ms/o0ukef
From: Viktor Liu @.> Sent: Monday, July 1, 2024 7:57:00 AM To: netbirdio/netbird @.> Cc: Carlos Hernandez @.>; Mention @.> Subject: Re: [netbirdio/netbird] Debounce network changes (PR #2197)
Hi @hurricanehrndzhttps://github.com/hurricanehrndz,
we want to go with a slightly different solution that doesn't ignore potential changes for 3 seconds. I'll close this PR and create a new one. Thank you for bringing the issue to our attention and the inspiration.
— Reply to this email directly, view it on GitHubhttps://github.com/netbirdio/netbird/pull/2197#issuecomment-2200228310, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABMJBTKWN7FQFSAUONYUF2TZKFN2ZAVCNFSM6AAAAABJ4LT4FKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBQGIZDQMZRGA. You are receiving this because you were mentioned.Message ID: @.***>