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

fix(debugging): Don't close inspector socket after 30 sec. timeout #907

Merged
merged 2 commits into from
May 23, 2018

Conversation

mbektchiev
Copy link
Contributor

@mbektchiev mbektchiev commented Apr 10, 2018

PR Checklist

What is the current behavior?

The inspector listening socket is being closed 30 sec. after the last
activity on it (opening, disconnection, etc). It had to be closed in order
to have the hardcoded port number 18181 available for other apps after
finishing (or never starting) a debugging session. Without this timeout
the first app that opened the port would take it for as long as it's running
and would prevent any subsequent debugging attempts of another app on
the same iOS device; or even any {N} app on any iOS Simulator on the
same Mac machine.

What is the new behavior?

From now on, the default port becomes 18182 and if it is unavailable,
a random free port will be used. Its number will be output in the
application log. When starting a debug session, {N} CLI will monitor
the logs in order to receive the allocated port number for the current
session.

This will allow to connect the frontend at any moment after starting a
debug session, instead of failing after the 30 seconds have elapsed.

This PR has to be merged along with NativeScript/nativescript-cli#3540. Wait for it to be approved.

@mbektchiev mbektchiev self-assigned this Apr 10, 2018
@mbektchiev mbektchiev force-pushed the bektchiev/random-inspector-port-on-device branch from b6e4540 to 108d369 Compare April 17, 2018 07:56
@Natalia-Hristova
Copy link
Contributor

run ci

1 similar comment
@mbektchiev
Copy link
Contributor Author

run ci

We had to close it in order to have the hardcoded port number 18181
available for other apps after finishing (or never starting) a
debugging session. Without this timeout the first app that opened
the port would take it as long as it's running and would prevent
any subsequent debugging attempts of another app on the same iOS device;
or even the same app on another iOS Simulator on the same Mac machine.

From now on, if the 18181 port is unavailable, a random free port \
will be used and its number will be output in the application log.
When starting a debug session, {N} CLI will monitor the logs
in order to receive the allocated port number for the current
session.
The reason for this change is that due to the new logic
of never closing it, any application with ios-runtime 4.1
or later could permanently take it and prevent apps with
an older runtime version from being debugged. We still
prefer to have a default port for easier local development
using `debugger-proxy.js`
@mbektchiev mbektchiev force-pushed the bektchiev/random-inspector-port-on-device branch from 108d369 to 6781d25 Compare April 23, 2018 13:42
@mbektchiev mbektchiev changed the title fix(debugging): Don't close inspector socket after 30 sec. timeout WIP: fix(debugging): Don't close inspector socket after 30 sec. timeout Apr 23, 2018
@mbektchiev mbektchiev changed the title WIP: fix(debugging): Don't close inspector socket after 30 sec. timeout fix(debugging): Don't close inspector socket after 30 sec. timeout May 22, 2018
@mbektchiev mbektchiev merged commit 6f5ac2d into master May 23, 2018
@mbektchiev mbektchiev deleted the bektchiev/random-inspector-port-on-device branch May 23, 2018 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants