Threadpool in the Android VPN app keeps filling and dropping connections

Open
#2,805 3 comments 0 reactions 1 assignee View on GitHub

@NghiaTranUIT is already working on this.

Since Oct 30, 2026.

Assessment

This issue has not been assessed yet.

Description

✅ Done bug

Description

The Proxyman VPN app (com.proxyman.proxymanvpn) that the Android emulator setup installs stops forwarding all traffic after a few minutes of normal use. The emulator then appears to have no internet: DNS lookups fail and HTTPS requests through the proxy time out.

It looks like the app leaks one IO thread and one UDP socket per DNS lookup. Each lookup gets its own UDP socket to 8.8.8.8:53, and a coroutine on Dispatchers.IO blocks on a receive with no timeout. Neither the socket nor the thread is ever released. After about 60 lookups, all 64 Dispatchers.IO worker threads are blocked, so the app can no longer relay TCP connections either.

Restarting the VPN app (for example by running the emulator setup again) fixes it until the thread pool fills up again.

Steps to Reproduce

  1. Start an Android emulator (API 37, arm64, Google APIs image without Play Store).
  2. In Proxyman, run the Android emulator setup (android_emulator_override). This installs the CA certificate, sets the global HTTP proxy and installs the Proxyman VPN app.
  3. Open the Proxyman VPN app on the emulator and start the VPN.
  4. Use apps that make network requests (a browser and an app that makes regular API calls) for 3–5 minutes.

Current Behavior

After a few minutes the emulator loses connectivity:

  • adb shell ping www.vg.no returns unknown host. Apps get java.net.UnknownHostException.
  • New TCP connections are accepted by the VPN app (PacketRouter: Forwarding 247 bytes to proxy for 10.255.0.1:… -> <mac-ip>:9090), but no response ever comes back. Proxy replies in the VPN app's log fell from about 400 per minute to 0 over three minutes.
  • The VPN app's process shows:
    • 64 DefaultDispatcher-worker threads, the maximum for Dispatchers.IO.
    • 61 of them blocked in __skb_wait_for_more_packets (/proc/<pid>/task/*/wchan), which is a blocking datagram receive.
    • 75 open UDP sockets connected to 8.8.8.8:53 (/proc/net/udp6, filtered on the app's uid), one per DNS query since the app started.
    • The process uses no CPU while in this state.
  • The Mac side is fine. Proxyman answers on port 9090: curl -x http://<mac-ip>:9090 https://www.vg.no returns 200. DNS against 8.8.8.8 also works from the Mac.
  • The emulator's own network works when it bypasses the VPN: ping -I eth0 8.8.8.8 and ping -I eth0 <mac-ip> both succeed.

Restarting the VPN app restores connectivity for a few minutes.

Expected Behavior

The VPN app keeps forwarding traffic for as long as it runs. The DNS (UDP) relay times out or closes each socket once it has an answer, and it does not hold a Dispatchers.IO thread indefinitely. A slow or missing UDP response should not stop TCP relaying.

Environment

  • App version: Proxyman 26.3.0 (macOS), Proxyman VPN app com.proxyman.proxymanvpn 1.0 (versionCode 1)
  • macOS version: macOS 27.2 (26B123), Apple Silicon (arm64)
  • Android emulator: 37.2.12.0, system image API 37 (Android 17), sdk_gphone16k_arm64, Google APIs without Play Store

Additional details

Workaround: stop the VPN (adb shell am force-stop com.proxyman.proxymanvpn) and rely on the global HTTP proxy alone (settings get global http_proxy = <mac-ip>:9090). Apps that honor the system proxy are still captured and decrypted, and DNS goes directly through the emulator's network. Traffic from apps that ignore the system proxy is not captured.

Commands to check for the leak while the VPN runs:

PID=$(adb shell pidof com.proxyman.proxymanvpn)
# Count worker threads (64 means the IO pool is exhausted)
adb shell "ls /proc/$PID/task | while read t; do cat /proc/$PID/task/\$t/comm; done" | grep -c DefaultDispatch
# What they are blocked on
adb shell "for t in \$(ls /proc/$PID/task); do cat /proc/$PID/task/\$t/wchan; echo; done" | sort | uniq -c
# DNS sockets held open by the app (remote 0808080808:0035 is 8.8.8.8:53)
adb shell cat /proc/net/udp6 | grep -c 08080808:0035

This issue was found using Claude Code after asking it to research why the Proxyman VPN stopped working frequently on the emulator.

Dominant language
No language data
Stars
7.1k
Forks
238
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ProxymanApp/Proxyman

All issues in ProxymanApp/Proxyman

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.