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

JS Server Never Terminates #18122

Closed
ballenwillis opened this issue Feb 27, 2018 · 3 comments
Closed

JS Server Never Terminates #18122

ballenwillis opened this issue Feb 27, 2018 · 3 comments
Labels
Help Wanted :octocat: Issues ideal for external contributors. Platform: Linux Building on Linux. Resolution: Locked This issue was locked by the bot.

Comments

@ballenwillis
Copy link

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
OS: Linux 4.13
Node: 8.9.4
Yarn: 1.3.2
npm: 5.6.0
Watchman: Not Found
Xcode: N/A
Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: ^0.53.3 => 0.53.3

Target Platform: android:minSdkVersion="16"
android:targetSdkVersion="23"

Steps to Reproduce

(On a linux machine)

  1. run command "sudo lsof -i :8081" and kill any processes on that port with the command "kill -9 "
  2. react-native init test
  3. cd test
  4. react-native run-android
  5. close/stop terminal (either by closing out of the terminal or pressing ctrl+c; doesn't matter)
  6. run command "sudo lsof -i :8081".

Expected Behavior

There are no processes active on port 8081 and you can run "react-native run-android" any time in the future and it works.

Actual Behavior

The JS server is still running on port 8081. I do not understand why, but this creates a problem when running the app again. After starting the intent (usually the last thing in the terminal after running react-native run-andriod), it just stops automatically as seen in my terminal below:
react-native-run-android-abrupt-termination

Versus how I usually stop it as seen in my terminal below:
react-native-correct-termination

Reproducible Demo

https://github.com/BWillis98/test
I apologize that I know nothing about "snack", but I've uploaded the test repository I created when going through "Steps to reproduce". I don't think it's really necessary since all I did was run the command "react-native init test" and then push it to a github repository.

Workaround To Problem

Run the command "sudo lsof -i :8081", make note of the PID of the process where the column under "COMMAND" is titled "node", and then run the command "kill -9 [PID]" as demonstrated here:

workaround

However, I don't want to do this every time I want to load the app onto my phone and it took a lot of time to narrow down the issue to this and I'd like to save future developers the time of fixing this issue.

@ballenwillis
Copy link
Author

?

@react-native-bot react-native-bot added the Platform: Linux Building on Linux. label Mar 20, 2018
@ballenwillis
Copy link
Author

Another workaround is this:

https://github.com/livioso/react-native-kill-packager

@fendorio
Copy link

If you have no other node process running on the machine the killall command should do the trick, just incase someone stumbles upon this, and has no other node process running on their box, e.g. a node HTTP server.

killall node

jamsch added a commit to jamsch/react-native that referenced this issue Aug 8, 2018
Commit 79e498b claims that "--terminal" has been added as an argument to the "run-android" script which it hasn't. Instead it adds a new environment variable "process.env.REACT_TERMINAL" which seems to be undocumented and nowhere else in the repository. 

This commit now allows the user to specify their custom terminal as an argument as per the following:

    react-native run-android --terminal=x-terminal-emulator

Additionally the child process "detached" option has been set to false if no terminal has been specified which fixes an issue where the packager would be running in the background and would have to manually be closed by finding the process. 

Fixes facebook#18122
hramos pushed a commit that referenced this issue Aug 22, 2018
Summary:
Commit 79e498b claims that "--terminal" has been added as an argument to the "run-android" script which it hasn't. Instead it adds a new environment variable "process.env.REACT_TERMINAL" which seems to be undocumented and nowhere else in the repository.

This commit now allows Linux and OSX users to specify their custom terminal :

    react-native run-android --terminal=x-terminal-emulator

Additionally the metro bundler child process "detached" option has been set to false if no terminal has been specified on Linux which fixes an issue where the packager would be running in the background and would have to manually be closed by finding the process.

Fixes #18122
Pull Request resolved: #20584

Differential Revision: D9234990

Pulled By: hramos

fbshipit-source-id: 60e4cc57b2790c419d5a4f9027add04313ddf6f8
aleclarson pushed a commit to aleclarson/react-native that referenced this issue Sep 16, 2018
Summary:
Commit 79e498b claims that "--terminal" has been added as an argument to the "run-android" script which it hasn't. Instead it adds a new environment variable "process.env.REACT_TERMINAL" which seems to be undocumented and nowhere else in the repository.

This commit now allows Linux and OSX users to specify their custom terminal :

    react-native run-android --terminal=x-terminal-emulator

Additionally the metro bundler child process "detached" option has been set to false if no terminal has been specified on Linux which fixes an issue where the packager would be running in the background and would have to manually be closed by finding the process.

Fixes facebook#18122
Pull Request resolved: facebook#20584

Differential Revision: D9234990

Pulled By: hramos

fbshipit-source-id: 60e4cc57b2790c419d5a4f9027add04313ddf6f8
t-nanava pushed a commit to microsoft/react-native-macos that referenced this issue Jun 17, 2019
Summary:
Commit 79e498b claims that "--terminal" has been added as an argument to the "run-android" script which it hasn't. Instead it adds a new environment variable "process.env.REACT_TERMINAL" which seems to be undocumented and nowhere else in the repository.

This commit now allows Linux and OSX users to specify their custom terminal :

    react-native run-android --terminal=x-terminal-emulator

Additionally the metro bundler child process "detached" option has been set to false if no terminal has been specified on Linux which fixes an issue where the packager would be running in the background and would have to manually be closed by finding the process.

Fixes facebook#18122
Pull Request resolved: facebook#20584

Differential Revision: D9234990

Pulled By: hramos

fbshipit-source-id: 60e4cc57b2790c419d5a4f9027add04313ddf6f8
t-nanava pushed a commit to microsoft/react-native-macos that referenced this issue Jun 17, 2019
Summary:
Commit 79e498b claims that "--terminal" has been added as an argument to the "run-android" script which it hasn't. Instead it adds a new environment variable "process.env.REACT_TERMINAL" which seems to be undocumented and nowhere else in the repository.

This commit now allows Linux and OSX users to specify their custom terminal :

    react-native run-android --terminal=x-terminal-emulator

Additionally the metro bundler child process "detached" option has been set to false if no terminal has been specified on Linux which fixes an issue where the packager would be running in the background and would have to manually be closed by finding the process.

Fixes facebook#18122
Pull Request resolved: facebook#20584

Differential Revision: D9234990

Pulled By: hramos

fbshipit-source-id: 60e4cc57b2790c419d5a4f9027add04313ddf6f8
@facebook facebook locked as resolved and limited conversation to collaborators Aug 20, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Aug 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Help Wanted :octocat: Issues ideal for external contributors. Platform: Linux Building on Linux. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants