Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port Forwarding Failed #376

Closed
mrfrasier opened this issue Jun 5, 2019 · 18 comments
Closed

Port Forwarding Failed #376

mrfrasier opened this issue Jun 5, 2019 · 18 comments
Labels
Milestone

Comments

@mrfrasier
Copy link

Forwarding port for debugging failed for platform "ios" and port 7936 because no connected devices could be found.

Getting this repeatedly. Then suddenly, it will work, then once again it doesn't work.

  • The install SUCCEEDS
  • running idb -devices manually shows my iPhone

Any ideas?

@joshtynjala
Copy link
Member

It's odd that it works sometimes, but not others. That makes things tricky.

The SWF debugger exits with that error message when it cannot find your device listed in the output from idb -devices.

When you tried running idb -devices manually, did you do it more than once? It might be smart to try running it after every time that it fails in VSCode. You might be more likely to reproduce outside of VSCode in that case. If you can reproduce using idb, we can rule out a bug in my parsing code in VSCode.

Also, don't ignore the possibility that your USB cable has some minor damage. I've had to throw out more than one that would randomly disconnect when I picked up and moved the device that I had connected to my computer for a debugging session.

@mrfrasier
Copy link
Author

I'm wondering if there's just something finnicky on the VS Code side. idb -devices has yet to fail to identify my phone. It also works in Animate (which I'm trying to migrate from since it's clunky) and iTools (which I ended up using to install the ipa with, but still can't get debug working).

I did think the USB cable might be at fault, so I swapped it with the one we use on another device, and still the same sadly.

@piotrzarzycki21
Copy link

I'm wondering if there's just something finnicky on the VS Code side. idb -devices has yet to fail to identify my phone. It also works in Animate (which I'm trying to migrate from since it's clunky) and iTools (which I ended up using to install the ipa with, but still can't get debug working).

I did think the USB cable might be at fault, so I swapped it with the one we use on another device, and still the same sadly.

A while ago I have started to experience problem with my external audio interface which is being connected with my laptop. I'm on windows and my laptop is not new. After trying several things changing cable/contacting with support of that audio interface I ended up that my usb itself is at some point corrupted. I encourage you to try with completely different laptop/PC to see whether is not a hardware problem itself.

@mrfrasier
Copy link
Author

A hardware problem that ONLY affects VS Code? I see my phone in iTunes. idb -devices sees my phone. I can install my app via Animate, and likewise I can use iTools to install and manage my device as well.

A hardware issue that ONLY affects VS Code seems very unlikely.

@piotrzarzycki21
Copy link

A hardware problem that ONLY affects VS Code? I see my phone in iTunes. idb -devices sees my phone. I can install my app via Animate, and likewise I can use iTools to install and manage my device as well.

A hardware issue that ONLY affects VS Code seems very unlikely.

It's just a shot. I hope you resolve your issue.

@mrfrasier
Copy link
Author

Thanks, I do too!

Josh your mention of parsing got me thinking it might be my device name since it has an apostrophe in it, but the same still happens on an iPhone X simply named "iPhone X".

For now, what fixes it is a reboot, so I'll do that. Perhaps there's some process that gets hung or stuck that causes things to lock up like this.

@joshtynjala
Copy link
Member

Perhaps there's some process that gets hung or stuck that causes things to lock up like this.

Yeah, I could see that being a possibility. It may depend on how you stop the debugger. I'll try to find some time to look into it.

@joshtynjala
Copy link
Member

joshtynjala commented Jun 6, 2019

I tried a few things on my computer, but it seems to find my iPad pretty consistently.

The parser ignores the device's name. It only cares about the device's "handle".

It reads the output from idb -devices line by line. If a line starts with " " (three spaces), that's a device:

   1	iPhone  	0000000000000000000000000000000000000000	iPhone

If it finds the three spaces, it looks for a tab character (\t). Whatever appears between the three spaces and the tab is the device's handle. In the example above, the handle would be "1". The parser ignores the rest of the line.

If a line does not start with three spaces, the parser skips it completely and tries the next line.

When you run idb -devices is your output formatted any differently? Could it be that a line doesn't always start with three spaces? I could see that happening if the handle is multiple digits, I guess.

@mrfrasier
Copy link
Author

Sorry for the delay josh -- I copy and pasted the output into an editor and it doesn't appear that's any different. Also, it works sometimes and others not, so I assume your parsing is fine.

As a reboot tends to fix it, I'm going to go with some process gets hung or locked somewhere. What that is, I'm not sure, but I will keep poking around when it happens.

When calling idb, does your code rely on anything else? i.e. I know Animate has its own instance of adb running etc.

@joshtynjala
Copy link
Member

No other processes are started by the SWF debugger before idb is used to get the device handle. After that, the debugger runs commands with adt only. It does not use adb directly (I assume that adt runs adb behind the scenes).

I wouldn't expect adb to have any conflicts here, since it's for Android, and the issue is with iOS specifically.

@mrfrasier
Copy link
Author

Yeah, I didn't expect so either (I only mentioned adb since that's the process that came to mind that Animate manages and thought iOS may have a similar).

No one else seems to be having the issue and I have a short-term workaround, so we can close this up. If I can figure out how to reliably reproduce it (and it's something that affects everyone), I'll definitely share

@mrfrasier
Copy link
Author

Was able to reproduce twice this morning. The build process as you know can be a bit lengthy, so I switched over to answer some emails while waiting for the "enter password" prompt. I guess I took longer than it liked as I got a popup error asking me to check launch.json. After that, I repeatedly got the

Forwarding port for debugging failed for platform "ios"

error until I rebooted my computer. Tried it again (letting that part time out) and was able to reproduce the issue. Another reboot (whole reboot, just closing the app doesn't seem to work) fixed it.

@joshtynjala
Copy link
Member

Thanks! That seems like it might help me reproduce too.

@joshtynjala joshtynjala added this to the v0.21 milestone Jul 3, 2019
@pbranco-magikbee
Copy link

Hi,

This topic is closed, but I'm experiencing the same problem getting the error message:
"Forwarding port for debugging failed for platform "ios" and port 7936 because no connected devices could be found."

ida -devices shows the device connected and I'm able to fwd the port and run the debugger manually.

My handler number is 2 digits, so I'm wondering if it has to do with the parsing.

@mrfrasier
Copy link
Author

I don't have a direct answer for you, but for me, I found it still happens from time to time so I've stopped relying on it.

What I do now is build a debug release ipa and install it with itools (you can use itunes or w/e). Then I just launch remote debug (attach) in VSCode and go from there. This also makes it smoother to repeatedly test the same build after relaunches.

@joshtynjala
Copy link
Member

@pbranco-magikbee Can you run idb -devices on the command line manually and copy/paste the output here in a comment? Be sure to format it as a code block so that the formatting is not lost.

I've never seen two digits on an iOS device, so it'll be hard for me to reproduce myself. That's why it's important to try to keep the formatting exactly the same. I'm looking for how two digits affects the rendering of a line. It might have a different number of spaces at the beginning, or something like that, so it's super important to get that right.

Thanks!

@pbranco-magikbee
Copy link

Here it goes:

List of attached devices:
Handle	DeviceClass	DeviceUUID					DeviceName
  22	iPad    	b385ad8d9080e54c11a1e93d958c36eb300dcb29	iPad4 de engageLab

@joshtynjala
Copy link
Member

@pbranco-magikbee Thank you! It looks like there are two spaces instead of three, so I'll need to update that parsing code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants