DefGuard / DefGuard/client

Serious Connection and Resource Management Issues in DefGuard Client

Aperta
#265 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
369
Fork
39
Merge medio
13h 24m
PR unite (30g)
33

Descrizione

Hey team,

I've noticed some important issues with the DefGuard client that need attention. Here's a breakdown of what's happening:

## The Issues I'm Facing

The DefGuard client is experiencing multiple critical issues, including unexpected errors, connection failures, shutdown problems, and difficulties establishing WireGuard VPN connections due to routing configuration errors.

## Specific Problems

1. After several connect-disconnect cycles, I'm getting an "unexpected error" message that prevents further connections.
2. Once this error occurs, it's impossible to establish new connections.
3. When closing the app, sometimes the WireGuard interface remains active and continues to send packets.
4. The client repeatedly fails to create WireGuard interfaces (it tries from utun3 to utun17) due to routing configuration errors.

## How to Reproduce These Issues

1. Open the DefGuard client.
2. Try to connect to a VPN location.
3. You'll likely see a failure to create a WireGuard interface due to routing errors.
4. If a connection is established, disconnect from the VPN.
5. Repeat steps 2-4 several times.
6. Try to connect again after encountering the "unexpected error".
7. Close the app and monitor network activity - you may see ongoing activity.

## What Should Be Happening

- The client should remain stable through multiple connect/disconnect cycles.
- Errors should be handled gracefully, allowing further connection attempts.
- Closing the app should properly shut down all processes and network interfaces.
- The client should be able to create a WireGuard interface without issues.
- Routes should be correctly configured for the new interface.
- A VPN connection should be successfully established.

## The Error Message I'm Seeing

I consistently get this error:

Failed to configure routing for WireGuard interface utunX: Command returned error status: ``

(X is a number between 3 and 17, depending on which interface it's trying to set up)

## Potential Causes

I'm considering several possibilities:

1. Resource leaks during connect/disconnect cycles.
2. State inconsistencies between the client and server.
3. Accumulation of minor errors leading to system instability.
4. Possible race conditions or deadlocks in multi-threaded operations.
5. Incomplete cleanup during app shutdown.
6. Desynchronization between the main app and the WireGuard service.
7. Conflicts with existing network configurations or other VPN software.

## Technical Details

- Client Version: 0.4.0
- Operating System: macOS
- Date First Observed: July 29, 2024
- Frequency: Consistently reproducible after multiple connect/disconnect cycles

## Relevant Logs

[2024-07-30][02:22:53][INFO][defguard_client::appstate] Removed connection from active connections: ActiveConnection {
location_id: 1,
connected_from: "192.168.0.7",
start: 2024-07-30T02:21:24.813626,
interface_name: "utun3",
connection_type: Location,
}
[2024-07-30][02:22:54][ERROR][defguard_client::appstate] Couldn't find connection with id: 1, connection_type: Location in active connections.
[2024-07-30][02:22:54][WARN][defguard_client::utils] Interface data stream disconnected

## Impact

These issues are severely affecting the reliability and usability of the DefGuard client. I'm unable to establish VPN connections, and there's a risk of unexpected data transmission and resource consumption even after the application is closed.

This issue needs to be prioritized for investigation and resolution. Any insights or suggestions would be greatly appreciated.

Let me know if you need any more information or clarification.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia tracciando il ciclo di vita di connessione/disconnessione in defguard_client::appstate e la gestione del flusso di dati dell’interfaccia in defguard_client::utils, quindi riproduci i cicli ripetuti e il problema di routing su macOS. Il lavoro è completato quando le connessioni ripetute si ripristinano dopo gli errori, le interfacce e le route WireGuard vengono configurate correttamente e la chiusura dell’app rimuove le interfacce attive e interrompe l’attività di rete.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
macos, rust
Ambito
desktop, networking, security
Tipo di issue
Bug
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.