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

Freeze & Crash when remote debug enabled [email protected] #12223

Closed
patrikholcak opened this issue Feb 6, 2017 · 39 comments
Closed

Freeze & Crash when remote debug enabled [email protected] #12223

patrikholcak opened this issue Feb 6, 2017 · 39 comments
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@patrikholcak
Copy link

patrikholcak commented Feb 6, 2017

Description

I tried to update an existing project to [email protected] and noticed that the app freezes and crashes when I try to dispatch a redux action open a modal. I then went and tried to isolate the issue and found out it crashes only when remote debug is enabled, which makes me think it might not be related to redux. This is the last error in console:

Error: Attempted to remove more RCTKeyboardObserver listeners than added

Reproduction

  1. clone and install patrikholcak/react-native-remote-bug
  2. Run iOS simulator, toggle remote debug on
  3. Click Toggle modal — first click will freeze the app and the second one will crash it

Solution

No idea.

Additional Information

  • React Native version: 0.42.0-rc.1
  • Platform: iOS
  • Operating System: MacOS
@neosavvy
Copy link

neosavvy commented Feb 6, 2017

I just started a small Application to learn some React Native / Redux / React Navigator and noticed that if I kill my application on device and then try to open it again, it'll crash after a long timeout.

I have a project here with similar errors after installing it on device, works fine in simulator.

https://github.com/neosavvy/lift

@reyesr
Copy link

reyesr commented Feb 20, 2017

I think this issue is also related to #12368 and appears when using Modal on IOS, in a specific context, in debug mode.

I do not use redux, my app actually uses NavigationExperimental (the root component of the display is a NavigationCardStack) and when I display a Modal on IOS in Debug Mode, the render() function freezes and the modal is never displayed. On Android, the very same code works fine in both Normal and Debug Mode.

This freeze happens in 0.42.0-rc3, but NOT in 0.41.2.

I couldn't create a minimal app that reproduces the bug, as just adding a modal to the default app created after an init' does not trigger the issue. There is something more, but not sure what makes the issue appear.

@K-Leon
Copy link
Contributor

K-Leon commented Feb 25, 2017

For me it's triggered if i'm transitioning towards a scene that contains an visible modal which is shown on render.

@K-Leon
Copy link
Contributor

K-Leon commented Feb 25, 2017

The only significant change i observed between .41 and .42 is this one: f33f84e

Could this be related?
@shergin

@shergin
Copy link
Contributor

shergin commented Feb 25, 2017

@K-Leon It is very unlikely, IMO. Could you please locally revert that (f33f84e) commit and test again?

@K-Leon
Copy link
Contributor

K-Leon commented Feb 25, 2017

@shergin Sorry for the wrong ping! You're absolutely right.

i did a git bisect of the whole release and the offending commit is 407973a
@cailenmusselman Could you look into it? To resolve this i deleted the elevation part locally and it works perfectly again.
Is there some polyfill missing in chrome debugger to support elevation props?

Funny thing is I noticed a similar bad behavior on android - i'm still looking into it where it could come from. It's not related to a modal but seems to be related to touchables on top of a native view - but it also only happens while debugging.

@cailenmusselman
Copy link
Contributor

Hey guys, I'll take a look at this early this week.

Weird that it would be my commit causing an issue on iOS though since the only edit was to the YellowBox's "elevation" style property, which is an android-only property.

@neosavvy
Copy link

neosavvy commented Feb 27, 2017 via email

@K-Leon
Copy link
Contributor

K-Leon commented Feb 27, 2017

@neosavvy >
This has absolutely nothing (!) to do with wifi or dropping connections - i've a stable environment and it's also reproducable on Simulator every time....

The Elevation thing seems to be incompatible with chrome js engine or triggers there some bug.

@cailenmusselman
Copy link
Contributor

Okay @K-Leon I'll still take a look early this week. Are your steps to reproduce different from the original (patrikholcak/react-native-remote-bug)?

@neosavvy
Copy link

neosavvy commented Feb 27, 2017 via email

@K-Leon
Copy link
Contributor

K-Leon commented Feb 27, 2017

No - not really. Happens all the time for me. Just take simulator, iOS and a medium sized app. Pushing a button that leads to a scene with a modal triggers it for me.

@alphasp
Copy link

alphasp commented Mar 3, 2017

I am having similar issue when running on ios with version 0.43.0-rc.0 with remote debug enabled.
It can be reproduce by creating a new project with react-native init --version="0.43.0-rc.0" rn43, then add a console.warn in render function, the screen will be render in blank and no yellow box appear.

  render() {
    console.warn("test warning here");
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
        <Text style={styles.instructions}>
          To get started, edit index.ios.js
        </Text>
        <Text style={styles.instructions}>
          Press Cmd+R to reload,{'\n'}
          Cmd+D or shake for dev menu
        </Text>
      </View>
    );
  }

@cailenmusselman
Copy link
Contributor

Will try and find the time to investigate today

@micopc
Copy link

micopc commented Mar 3, 2017

I'm also having the same problem on version 0.42. When I try to open a modal, the app freezes and after trying to interact with it, it crashes. Also the remote debugger is showing this warning: "Calling of [-RCTUIManager setFrame:forView:] which is deprecated." Which might be related to the commit f33f84e

@cailenmusselman
Copy link
Contributor

Oooookay guys, so I have it figured out... sort of.

The elevation changes I introduced to YellowBox cause iOS apps to hang when remote debugging is enabled and a warning is logged.

So my changes do not effect the Modal component directly, it's just that Modal is logging the warning "Calling of '[-RCTUIManager setFrame:forView]' which is deprecated" which in turn brings out the bug introduced by my YellowBox changes in iOS.

So the actual bug we're observing is what @alphasp posted.

In summary:
Android + no remote debugging = OK
Android + remote debugging = OK
iOS + no remote debugging = OK
iOS + remote debugging = HANGS

Interestingly, if I change elevation: Number.MAX_VALUE to Number.MAX_SAFE_INTEGER the bug dissappears. So maybe there's some sort of overflow occurring on iOS, I'm not sure.

I don't really have the time to get to the actual root of the issue, so I just propose any of these changes:

elevation: Platform.OS === 'android' ? Number.MAX_SAFE_INTEGER : undefined // since elevation IS only an android property

or 2)

elevation: Number.MAX_SAFE_INTEGER

or 3)

elevation: 1000 // pick a value, any value

Preferences? Or does someone want to get to the ACTUAL root of the issue?

@reyesr
Copy link

reyesr commented Mar 4, 2017

Thansk for digging into the issue @cailenmusselman !

I think your first choice (1) is pretty good, as long as elevation is not supported on IOS, keeping it undefined seems the better choice (ie, with the minimal possible side-effects)

@hilkeheremans
Copy link
Contributor

@cailenmusselman EXCELLENT work! I would also go with option (1).

Perhaps very obvious, but probably a good idea to comment a little extra in the code to provide context on why this change was done.

cailenmusselman added a commit to cailenmusselman/react-native that referenced this issue Mar 6, 2017
For unknown reasons, setting elevation: Number.MAX_VALUE causes remote debugging to hang on iOS (some sort of overflow maybe). Setting it to Number.MAX_SAFE_INTEGER fixes the iOS issue, but since elevation is an android-only style property we might as well remove it altogether for iOS.

See: facebook#12223
@mkonicek
Copy link
Contributor

mkonicek commented Mar 9, 2017

Thanks for the fix @cailenmusselman! #12744

Once it lands in master I'll cherry-pick it to 0.42 and 0.43.

facebook-github-bot pushed a commit that referenced this issue Mar 9, 2017
Summary:
For unknown reasons, setting elevation: Number.MAX_VALUE causes remote debugging to hang on iOS (some sort of overflow maybe). Setting it to Number.MAX_SAFE_INTEGER fixes the iOS issue, but since elevation is an android-only style property we might as well remove it altogether for iOS.

See: #12223
Closes #12744

Differential Revision: D4684524

Pulled By: mkonicek

fbshipit-source-id: 7fb4f6da1c5c0cb437beff0e75122523e7233b72
mkonicek pushed a commit that referenced this issue Mar 10, 2017
Summary:
For unknown reasons, setting elevation: Number.MAX_VALUE causes remote debugging to hang on iOS (some sort of overflow maybe). Setting it to Number.MAX_SAFE_INTEGER fixes the iOS issue, but since elevation is an android-only style property we might as well remove it altogether for iOS.

See: #12223
Closes #12744

Differential Revision: D4684524

Pulled By: mkonicek

fbshipit-source-id: 7fb4f6da1c5c0cb437beff0e75122523e7233b72
mkonicek pushed a commit that referenced this issue Mar 10, 2017
Summary:
For unknown reasons, setting elevation: Number.MAX_VALUE causes remote debugging to hang on iOS (some sort of overflow maybe). Setting it to Number.MAX_SAFE_INTEGER fixes the iOS issue, but since elevation is an android-only style property we might as well remove it altogether for iOS.

See: #12223
Closes #12744

Differential Revision: D4684524

Pulled By: mkonicek

fbshipit-source-id: 7fb4f6da1c5c0cb437beff0e75122523e7233b72
@robcalcroft
Copy link

Is there a work around for this yet?

@rcugut
Copy link

rcugut commented Mar 14, 2017

@robcalcroft the way I solved it was to locally edit the YellowBox.js file (inside node_modules/react-native/...) with the 3 lines from this commit: adeb5ff

Since this is only breaking development, it has no side-effects for production. It's an interim solution until a new react-native release is baked

@alphasp
Copy link

alphasp commented Mar 14, 2017

@robcalcroft the fix is already available in v0.42.1 and v0.43.0-rc.2

@adrai
Copy link

adrai commented Mar 14, 2017

v0.42.1 seems not to be published right now, but you can test it by putting this instead of v0.42.1 in the package.json: facebook/react-native#v0.42.1

@anonrig
Copy link

anonrig commented Mar 14, 2017

PS: When will the v.42.1 be released?

@robcalcroft
Copy link

@alphasp ok thanks

@adrai
Copy link

adrai commented Mar 16, 2017

I've tested with facebook/react-native#v0.42.1 in the package.json...

for ios everything fine (just a new warning) but for android the build fails with something like:

.../node_modules/react-native-image-crop-picker/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java:31: error: cannot find symbol
import com.facebook.react.modules.core.PermissionAwareActivity;
                                      ^
  symbol:   class PermissionAwareActivity
  location: package com.facebook.react.modules.core

:-(

@adrai
Copy link

adrai commented Mar 16, 2017

But seems to work better with: v0.43.0-rc.2 and new react v16.0.0-alpha.3 (on ios and android)

@just4fun
Copy link

I upgraded to v0.42.2 and it works.

just4fun added a commit to just4fun/stuhome that referenced this issue Mar 30, 2017
@sundou
Copy link

sundou commented Mar 31, 2017

I set console.disableYellowBox = true;
and it works too.

@amanthegreatone
Copy link

Hi,
Having same issue with RN 0.44.2. Launch the app and in debug mode and it freezes.

@cwagner22
Copy link

My app is also crashing when Remote Debugging is enabled, using 0.44.2. (It happens randomly so hard to track down, like every 1-5 mins). And with this issue happening at each launch it makes RN development a nightmare for me.

@soundstage
Copy link

I am having this issue on RN 0.45. Will upgrading to RN 0.46 or 0.47 solve this issue?

@rod-stuchi
Copy link

rod-stuchi commented Aug 23, 2017

Nope, fresh install RN 0.47.2 still has the problem. I tested only on Android.

edit

I has testing on AVD with API 23, with Remote JS Debugging enabled app crash when reload is called.

In logcat

E/Surface: getSlotFromBufferLocked: unknown buffer: 0xf40bd5c0
...
Fatal signal 11 (SIGSEGV), code 1, fault addr 0xea0c6000 in tid 3664

On AVD with API 26, works nicely 😄

@dobiedad
Copy link

dobiedad commented Sep 11, 2017

I had this issue today, tried all solutions but nothing worked. In the end i just rm -rf ios/build which seemed to have done the trick.

@sospedra
Copy link

sospedra commented Sep 29, 2017

@sundou workaround worked for me

Place this at your app's entry point

console.disableYellowBox = true

Tho... Well, this should be fixed 😞

@Fr33maan
Copy link

YellowBox didn't did the trick here but switching to API 26 works ! Thanks @rod-stuchi

@Nevosis
Copy link

Nevosis commented Oct 6, 2017

Switching to 26 worked for me too, thanks a lot. But it shouldn't be right ?

@avishayil
Copy link

Running the project from XCode, rather than run-ios, solves the issue here.
Still persists when running with run-ios.

@stale
Copy link

stale bot commented Jan 8, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 8, 2018
@stale stale bot closed this as completed Jan 15, 2018
@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests