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

BUG: (at least on Android) RN-app crashes, freezes or loses connection to development server when device is roaming and roaming is disabled on device #15305

Closed
Fonze opened this issue Aug 1, 2017 · 2 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@Fonze
Copy link

Fonze commented Aug 1, 2017

Is this a bug report?

Yes

Have you read the Bugs section of the How to Contribute guide?

Yes

Environment

react-native-cli: 2.0.1
react-native: 0.46.2 (tested on 0.44.0 too)
node: 8.2.0
npm -v

  • Target Platform: Android
  • Development Operating System: Windows 10
  • Build tools: Only Android emulators relevant for this bug (tested on 7.1.1 x86 and 6.0 x86)

Steps to Reproduce

  1. Create new RN-project
  2. Run it on Android emulator (not sure if same problem happens on iOS, haven't had the opportunity to test)
  3. Test it responds correctly (double-R pretty much proves the app is working fine, buttons that do something are also viable testers)
  4. Go to the phone's settings and make sure Roaming is turned off
  5. Emulate roaming on the emulator (0.44.0 might crash at this point)
  6. Go to the app an try reloading (is either frozen and does nothing or informs that there is no connection to development server)
  7. If you get the red error screen and the app is not crashed/frozen you can set the emulator's data status back to 'Home' or enable roaming again and double-R will work again.

Expected Behavior

Roaming should just cut the connection if roaming is disabled. Although listening to connection on a native Android app (with roaming disabled) going from connected state to roaming just returns disconnected, but going from disconnected state to roaming makes the connection awkwardly connect and disconnect again, but nothing bad happens to the native app itself.

Native app tested with the code below:
`private class ConnectionChangeReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo();
        //from connected state to roaming returns 'false'
        //from disconnected state to roaming returns first 'true' and then runs again with 'false'
        System.out.println(activeNetwork != null && activeNetwork.isConnected());
    }
}`

Actual Behavior

At first I tested this bug on a 0.44.0 app with self-made native Android ConnectionChangeListener partially shown above. Every other connection change did what expected (emitted custom event through DeviceEventEmitter and brought up a popup on disconnect and made it disappear on connect) but roaming with roaming disabled has made the app freeze (completely unresponsive to any click, Ctrl+M or double-R) or crashed it completely.

Thought it was the listeners fault at first but after some digging I thought it might be a problem with just RN. After that I created a new project with 'react-native init'-command (having global version 0.46.2 so this test is with that) ran it and emulated roaming. The app doesn't crash or freeze, but on reload throws the red screen with 'Could not connect to development server'-error.

@Fonze Fonze changed the title BUG: (at least) on Android RN-app crashes, freezes or loses connection to development server when device is roaming and roaming is disabled on device BUG: (at least on Android) RN-app crashes, freezes or loses connection to development server when device is roaming and roaming is disabled on device Aug 1, 2017
@pull-bot
Copy link

pull-bot commented Oct 9, 2017

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

@hramos hramos added the Icebox label Oct 9, 2017
@hramos hramos closed this as completed Oct 9, 2017
@haofeng123
Copy link

i have this question too

@facebook facebook locked as resolved and limited conversation to collaborators Oct 9, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants