react-native icon indicating copy to clipboard operation
react-native copied to clipboard

React native development errors caught by old network request's catch()

Open alekhurst opened this issue 10 years ago • 14 comments

I'm going to keep this relatively high level as I can't seem to re-create it in the demo app... But I'm having the weirdest problem in React Native 0.29.1 on iOS.

When there is an error thrown during the execution of the React Native code in dev mode on the iOS simulator, it is caught by a random catch() block from an old fetch request that completed long in the past.

When there is a dev error, it is passed as the err inside catch(err => console.log(err)). It then causes this very weird series of errors to appear in the console:

1st: ExceptionsManager.js:70 Warning: There is an internal error in the React performance measurement code. Did not expect componentDidUpdate timer to start while render timer is still in progress for another instance.

2nd: ExceptionsManager.js:55 Cannot read property 'getHostNode' of null

3rd: ExceptionsManager.js:70 Unhandled JS Exception: Cannot read property 'getHostNode' of null

alekhurst avatar Jul 19 '16 02:07 alekhurst

I am seeing this exact same thing and it seems that the cause is exactly the same, that is it is coming from a .catch(err => console.log(err)).

Here is the stack trace. This is not in React Native, but is coming from React ^15.0.1, React-Redux ^4.4.5, and Redux ^3.5.2 (full package.json can be seen here)

warning.js:44
beginLifeCycleTimer @   ReactDebugTool.js:106
onBeginLifeCycleTimer   @   ReactDebugTool.js:212
invokeComponentDidUpdateWithTimer   @   ReactCompositeComponent.js:63
notifyAll   @   CallbackQueue.js:67
close   @   ReactReconcileTransaction.js:81
closeAll    @   Transaction.js:204
perform @   Transaction.js:146
perform @   Transaction.js:138
perform @   ReactUpdates.js:90
flushBatchedUpdates @   ReactUpdates.js:173
closeAll    @   Transaction.js:204
perform @   Transaction.js:151
batchedUpdates  @   ReactDefaultBatchingStrategy.js:63
enqueueUpdate   @   ReactUpdates.js:201
enqueueUpdate   @   ReactUpdateQueue.js:25
enqueueSetState @   ReactUpdateQueue.js:209
ReactComponent.setState @   ReactComponent.js:64
handleChange    @   connect.js:301
(anonymous function)    @   makeAssimilatePrototype.js:15
dispatch    @   createStore.js:186
dispatch    @   VM23790:1570
(anonymous function)    @   index.js:208
(anonymous function)    @   index.js:38
(anonymous function)    @   index.js:9
dispatch    @   applyMiddleware.js:45
(anonymous function)    @   stations.js:85

RyanCCollins avatar Jul 23 '16 18:07 RyanCCollins

+1

jeanpan avatar Jul 25 '16 04:07 jeanpan

+1
react-native 0.27.2

oldashes avatar Jul 31 '16 12:07 oldashes

+1

fgarci03 avatar Aug 07 '16 01:08 fgarci03

+1

ackdav avatar Aug 12 '16 08:08 ackdav

+1

dcrobert avatar Aug 13 '16 20:08 dcrobert

+1

I'm getting this with react 15.3.0, redux 3.5.2, react-redux 4.4.5. I'm not using react-native, so it's something with react in general.

kelly-kellerheikkila avatar Aug 23 '16 15:08 kelly-kellerheikkila

+1, this is driving me crazy. All internal errors are now caught by the closest .catch() and there's no useful information in the stack trace this way. I get the same result using a reject function as the second argument of the .then()

Using react-native 29.2 but this is not a new bug.

Simply removing the .catch() will only convert the error into an Possible Unhandled Promise Rejection so that does not help.

my promises and the ones used internally in react-native should never be able to touch.

ThaJay avatar Aug 29 '16 16:08 ThaJay

+1

benhuang21828 avatar Aug 31 '16 01:08 benhuang21828

Could someone who has this without react-native post an issue on the react git? Perhaps there they know what to do

ThaJay avatar Aug 31 '16 10:08 ThaJay

btw, I only get Cannot read property 'getHostNode' of null if I use this.props.children. I was able to use this.props.children in the example app so perhaps it's a dependency messing things up? here are my deps:

    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-preset-react-native-stage-0": "^1.0.1",
    "backbone": "^1.3.3",
    "backbone-relational": "^0.10.0",
    "jquery": "^3.1.0",
    "levenshtein": "^1.0.5",
    "react": "^15.2.1",
    "react-native": "^0.29.2",
    "react-native-barcodescanner": "^3.0.0",
    "react-native-button": "^1.4.2",
    "react-native-dismiss-keyboard": "^1.0.0",
    "react-native-drawer": "^2.2.6",
    "react-native-keyboard-spacer": "^0.3.0",
    "react-native-router-flux": "^3.34.0",
    "react-native-sound": "^0.8.3",
    "react-native-vector-icons": "^2.0.3",
    "react-redux": "^4.4.5",
    "redux": "^3.5.2"

ThaJay avatar Aug 31 '16 13:08 ThaJay

well, in my case, fetch throw exception with status code 204. even whatwg-fetch return ok = true. anyone has same experience as mine? because of this issue, I have to return 200 status code after deleting contents

JosephDev avatar Sep 07 '16 17:09 JosephDev

For what it's worth, this hasn't seemed to be happening to me as much with RN 0.33.0. I have also not been working with writing network requests recently so... could be false alarm.

alekhurst avatar Sep 20 '16 20:09 alekhurst

Anecdotally this seems like it's better now so I am going to close this issue. If someone has a specific repro app that reproduces this problem on modern react native then I think it would be great to open a new issue though. Thanks for bringing this up!

lacker avatar Dec 15 '16 23:12 lacker