netbirdio / netbird

Connect your devices into a secure WireGuard®-based overlay network with SSO, MFA and granular access controls.
https://netbird.io
BSD 3-Clause "New" or "Revised" License
10.04k stars 441 forks source link

netbird service / connection is down when returning from sleep / hibernation #2011

Open ez1976 opened 2 months ago

ez1976 commented 2 months ago

Hi on windows it seems that when the computer is resumed from sleep or Hibernation, although the service is up and the netbird-gui display as connected, the user gets: "dial service - context deadline exceeded"

of course reboot / restart of the service / running "netbird down && nebird up" or "netbird service restart" will resume the connection just fine. attached one of the users client log at line 10980 the user restarted the computer (or the service) [Uploading netbird-client.log…]()

mlsmaycon commented 2 months ago

Can you upgrade the client to 0.27.7 and enable the network monitor?

You can do that by:

netbird down
netbird up -N
ez1976 commented 2 months ago

On it

On Sat, May 18, 2024, 15:34 Maycon Santos @.***> wrote:

Can you upgrade the client to 0.27.7 and enable the network monitor?

You can do that by:

netbird down netbird up -N

— Reply to this email directly, view it on GitHub https://github.com/netbirdio/netbird/issues/2011#issuecomment-2118843013, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANTDD2CEWIEVWPZLVSP6F3ZC5RI5AVCNFSM6AAAAABH5PO2ZOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJYHA2DGMBRGM . You are receiving this because you authored the thread.Message ID: @.***>

hurricanehrndz commented 2 months ago

I can also create a PR to update the UI so that it is based on the full-status @mlsmaycon if you all want. The reason again is because of the internal state never gets updated when signal and management endpoints become unavailable.

Network-monitor does help though, from time to time tough in rare instances you will get a resource busy with the wireguard interface, restarting the service does solve that. Seems like when restarting the engine there is a race condition, or for some odd reason removing the interface fails.

2024-05-06T09:09:19-07:00 INFO client/internal/routemanager/manager.go:93: Routing setup complete
2024-05-06T09:09:19-07:00 ERRO client/internal/engine.go:284: failed creating tunnel interface utun100: [resource busy]
2024-05-06T09:09:19-07:00 INFO client/internal/routemanager/manager.go:117: Routing cleanup complete
2024-05-06T09:09:19-07:00 ERRO client/internal/connect.go:245: error while starting Netbird Connection Engine: create wg interface: resource busy
hurricanehrndz commented 2 months ago
2024-05-08T14:28:50+01:00 DEBG client/internal/engine.go:1135: removing Netbird interface utun100
2024-05-08T14:28:50+01:00 ERRO client/internal/connect.go:245: error while starting Netbird Connection Engine: create wg interface: resource busy

https://github.com/netbirdio/netbird/blob/main/client/internal/engine.go#L1168

hurricanehrndz commented 2 months ago

I believe issue #2006 is related

Fossil01 commented 3 weeks ago

I have the same issue. Returning from a sleeping Mac and it shows as disconnected and won't connect.

error while starting Netbird Connection Engine: create wg interface: resource busy

ez1976 commented 3 weeks ago

Try netbird down netbird up -N

On Mon, Jul 1, 2024, 23:23 Fossil @.***> wrote:

I have the same issue. Returning from a sleeping Mac and it shows as disconnected and won't connect.

error while starting Netbird Connection Engine: create wg interface: resource busy

— Reply to this email directly, view it on GitHub https://github.com/netbirdio/netbird/issues/2011#issuecomment-2201192759, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANTDDZDINBHXKENUOSYR7DZKHJHFAVCNFSM6AAAAABH5PO2ZOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBRGE4TENZVHE . You are receiving this because you authored the thread.Message ID: @.***>

Fossil01 commented 3 weeks ago

Yeah that works. But this is a bug obviously :P

ez1976 commented 3 weeks ago

No. The -N adds a network monitor that resets the connection if the network adapter status changes. It is disabled by default

On Mon, Jul 1, 2024, 23:28 Fossil @.***> wrote:

Yeah that works. But this is a bug obviously :P

— Reply to this email directly, view it on GitHub https://github.com/netbirdio/netbird/issues/2011#issuecomment-2201203647, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANTDD24XNSW57B2JG4U3L3ZKHJZHAVCNFSM6AAAAABH5PO2ZOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBRGIYDGNRUG4 . You are receiving this because you authored the thread.Message ID: @.***>

Fossil01 commented 2 weeks ago

So I looked at it some more, running netbird up -N comes back with Connected. But running netbird status returns Error: status failed: create wg interface: resource busy. The admin panel also says I am still offline.

What I meant before, was that the -N flag should probably become an option in the app itself, and an option the client automatically configures when told to do so in the admin panel.

ez1976 commented 2 weeks ago

Or even better, enabled by default. After the laptop resumes from sleep give it a bit of time and it will restart the service. On windows laptops i actually pushed a task schedule to restart the service every time the laptop restarts or resumes from sleep

On Tue, Jul 2, 2024, 09:25 Fossil @.***> wrote:

So I looked at it some more, running netbird up -N comes back with Connected. But running netbird status returns Error: status failed: create wg interface: resource busy.

What I meant before, was that the -N flag should probably become an option in the app itself, and an option the client automatically configures when told to do so in the admin panel.

— Reply to this email directly, view it on GitHub https://github.com/netbirdio/netbird/issues/2011#issuecomment-2202301247, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANTDD7ZZOHN4PC5QYKUHC3ZKJPZHAVCNFSM6AAAAABH5PO2ZOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBSGMYDCMRUG4 . You are receiving this because you authored the thread.Message ID: @.***>

Fossil01 commented 2 weeks ago

Agree. Tailscale seems to just always work, even right after waking from sleep.