Failed to reconnect between networks
- Ngôn ngữ chính
- Kotlin
- Star
- 62.6k
- Fork
- 8.1k
- Merge trung bình
- 3 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 36
Mô tả
# VPN service fails to reconnect after switching network type (Wi-Fi ↔ mobile)
**Device:** Pixel 8 (stock), Android 17 CP2A.260805.005
**Build:** main branch, 2026-09-13 23:20 MSK
## Steps to reproduce
1. Start VPN service — works fine.
2. Switch network type (Wi-Fi ↔ mobile/rmnet), either direction.
## Expected behavior
Service automatically reconnects on the new network.
## Actual behavior
Service fails to reconnect and stays broken until manually stopped/started.
## Log evidence
The attached logcat shows an exception right at the moment of the auto-restart attempt after the network switch:
```
java.lang.RuntimeException: A WebView method was called on thread
'DefaultDispatcher-worker-3'. All WebView methods must be called on the
same thread.
StartCore-Manager: Failed to reload core: ...
```
The stack trace points to this call chain:
```
NetworkMonitor.scheduleHandover
-> CoreServiceManager.reloadCore
-> CoreServiceManager.launchCore
-> DialerWebviewService.stop
-> WebView.stopLoading
```
## Suspected cause
It looks like `DialerWebviewService.stop()` (`DialerWebviewService.kt`) calls a WebView method off the main thread, causing `reloadCore()` to throw and the core to never restart on the new network.
I'm not 100% sure — I only traced this from the log/stack trace, not the actual source. Would appreciate it if a maintainer could check that path (`DialerWebviewService.stop` / `CoreServiceManager.kt`) — it may need `runOnUiThread` / `Dispatchers.Main` instead of calling WebView directly from a coroutine.
## Attachments
- Full logcat
[v2ray.md](https://github.com/user-attachments/files/32170607/v2ray.md)
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Start with NetworkMonitor.scheduleHandover and trace the call chain through CoreServiceManager.kt and DialerWebviewService.kt. Reproduce a Wi-Fi/mobile network switch while inspecting logcat, then verify the service reconnects without the reported WebView thread exception or failed core reload.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- android, kotlin
- Lĩnh vực
- mobile, networking
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 72/100