Search code examples
androidwindowsadbwindows-subsystem-for-linux

android - error: protocol fault (couldn't read status): connection reset


I'm on a Windows 10 environment with WSL2 Ubuntu running, and after some difficulty port forwarding my adb on Windows in order for it to communicate with my WSL2 environment, I was able to run my apps via my WSL's adb installation.

These are the steps I followed in order for my WSL2's adb to see my devices on Windows: https://gist.github.com/monicalabbao/b303b260f0acba16735be2483f5210c5

The adb worked fine for both my WSL2 runtime and my Windows a few days until I opened my Android Studio on Windows to work on a native Android app, and now my Android Studio is no longer able to start its ADB:

6:14 PM error: protocol fault (couldn't read status): connection reset

6:14 PM 'C:\Users\me\AppData\Local\Android\Sdk\platform-tools\adb.exe start-server' failed -- run manually if necessary

My adb's Inbound Rules in the Windows Firewall are both Public and Private, and they are allowed to receive traffic from both local and remote IP addresses, in any scope.

I also have a custom rule that allows my WSL2 environment to communicate to my Windows environment within the scope of my home network's subnet.

Here's what I did to try fixing the problem:

  1. Restart adb.exe - adb.exe isn't found in my Task Manager in the first place.
  2. Restart Android Studio - Same problem
  3. Restart computer - the problem did not go away
  4. Manually restarting my ADB by adb kill-server and adb start-server on my PowerShell, still happens.
  5. Run Android Studio as administrator
  6. adb kill-server and adb -a -P 5037 nodaemon server on my PowerShell.
  7. Permit Android Studio to operate through my Windows Firewall on public networks (Inbound Rules)
  8. Cold booted an emulator. - The protocol fault simply repeated itself.
  9. Redownloaded my \platform-tools for my Android SDK

Here's my active ports in my Android studio: (netstat -ab)

[studio64.exe] TCP 127.0 .0 .1: 59952 [MY-PC]: 59951 ESTABLISHED
[studio64.exe] TCP 127.0 .0 .1: 59953 [MY-PC]: 59954 ESTABLISHED
[studio64.exe] TCP 127.0 .0 .1: 59954 [MY-PC]: 59953 ESTABLISHED
[studio64.exe] TCP 127.0 .0 .1: 59955 [MY-PC]: 59956 ESTABLISHED
[studio64.exe] TCP 127.0 .0 .1: 59956 [MY-PC]: 59955 ESTABLISHED
[studio64.exe] TCP 127.0 .0 .1: 60511 [MY-PC]: 60512 TIME_WAIT
  TCP 127.0 .0 .1: 60518 [MY-PC]: 60519 TIME_WAIT
  TCP 127.0 .0 .1: 60522 [MY-PC]: 60523 TIME_WAIT
  TCP 127.0 .0 .1: 60535 [MY-PC]S: 60536 ESTABLISHED
[studio64.exe] TCP 127.0 .0 .1: 60536 [MY-PC]: 60535 ESTABLISHED
[studio64.exe] TCP 127.0 .0 .1: 63342 [MY-PC]: 0 LISTENING
[studio64.exe] TCP 172.31 .192 .1: 139 [MY-PC]: 0 LISTENING

I also noticed that OriginWebHelperService and svchost are using ports 5554 and 5037 for some reason -- ports that I associate with my ADB and my emulator:

[OriginWebHelperService.exe] TCP 127.0.0.1:5037 [MY-PC]:0 LISTENING
  iphlpsvc
[svchost.exe] TCP 127.0.0.1:5554 [MY-PC]:0 LISTENING

That above might be a lead to what's going on, but I am not sure.

It is clear that my ADB's connection is reset, but not by a peer.

Short of resetting my PC, what could I have missed or have done to make my ADB act out this way?

Thank you!


Solution

  • I simply did a System Restore to a time before I started port forwarding to TCP 5554, and started adding new firewall rules. ADB daemon started at TCP port 5037 and that was it.

    8:18 AM * daemon not running; starting now at tcp:5037
    
    8:18 AM * daemon started successfully