React-native: Deadlock/Freeze with native modules and Remote debug 0.26.0

Created on 19 May 2016  路  30Comments  路  Source: facebook/react-native

Hi!
I have a fairly big project in react native where I after updating to 0.26.0 get a deadlock if I enable the Remote debugging option (With JSC the app runs great, as on 0.25.1). I've boiled this down to me having 2 custom native modules that implement RCTViewManager. If I remove either one of them (just uncomment RCT_EXPORT_MODULE()), the deadlock goes away and the app launches.

The deadlock presents it self in that the app becomes unresponsive and locked.
I think that this change might have something to do with this issue:

https://github.com/facebook/react-native/commit/9547a98a685cb9121c31cf19cd17f4ed0feeac2e

Let me know if I can provide more info.
Of course I've clear cache, reset simulator, watchman watch-del-all and derived data rm rf nodemodules etc.

Repro of the problem:
Build. Launch debugging. (Might work once), rebuild the project with debugging enabled in the simulator.
Should freeze.
https://github.com/olofd/Test-react-native-26

The repo has two native modules that return a UIView. Test and Test2

Locked

Most helpful comment

+1, same problem.

I replaced RCTBatchedBridge.m with the version in 0.25.1 and it's now working. Didn't dig in though.

https://github.com/facebook/react-native/blob/0.25-stable/React/Base/RCTBatchedBridge.m

All 30 comments

Yikes! How did this one slip through? When this occurs I literally have to delete the app from the simulator in order to get up and running again. A simple rebuild always results in a frozen blank white screen.

I'm not positive that it's related to Native Modules though @olofd...unless I'm forgetting one, I completely removed all Native Modules from my project and still can't debug in Chrome. Or is excluding the Native Module library file from the build phase not enough?

The only thing I have been able to gather about this is. If you run the app through Xcode instead of react-native run-ios in the "All Output" section of Xcode you see this:

2016-05-19 13:36:34.303 [error][tid:com.facebook.react.RCTBridgeQueue][RCTWebSocketExecutor.m:71] Connection to http://localhost:8081/debugger-proxy?role=client timed out. Are you running node proxy? If you are running on the device, check if you have the right IP address in `RCTWebSocketExecutor.m`.

Now I know that the simulator can reach that address in Safari and if I have debugging off it grabs the bundle just fine and runs with no deadlock.

@marcshilling Yes. I have to remove the app as well when this occurs. Glad it does not only happen on my two machines then. It's really weird and I'm not 100% sure that my theory of two modules vs. one module is correct. But I know that messing with/uncommenting RCT_EXPORT_MODULE() makes a difference.

FYI. I know that this was present in 0.26.0-rc as well. I tried that RC about a week ago, ran into this issue. and reverted back to 0.25.1. Had no time to investigate then.

The same problem is also here after updating to 0.26.

I'm experiencing the same after 0.26 update.

Ditto. Crying inside after all the effort spent to upgrade to 0.26

+1, same problem.

I replaced RCTBatchedBridge.m with the version in 0.25.1 and it's now working. Didn't dig in though.

https://github.com/facebook/react-native/blob/0.25-stable/React/Base/RCTBatchedBridge.m

@origsun
We did this too.

No FB members yet? Maybe we need a little poking?... @mkonicek @nicklockwood

Got the same issue here. Very frustrating..

same issue for me ... replacing RCTBatchedBridge.m did work for now

same here

Thanks for the ping. Is this iOS-only? There was a bug in remote debugging but I believe that was only on Android and got fixed in 0.26.1, @grabbou am I right?

I'm actually on 0.26.1 on iOS

upgrading to RN 27-rc fixed this for me.

TBH, i thought i was going mad.

@mkonicek the debugger issue was 0.27 specific problem and is to be released today / tomorrow (fixed already in master).

@jaygarcia 0.27 does not work with react native router flux which many people are using, so this means 0.26 is not very useable until this is fixed

@mkonicek @grabbou Android has the same problem 0.26.1, I scroll back to 0.26, and it works well.

@grabbou What was the fix please? Curious to understand how we can prevent it breaking in the future. More tests?

@mkonicek Replace RCTBatchedBridge.m with the version in 0.25.1
https://github.com/facebook/react-native/blob/0.25-stable/React/Base/RCTBatchedBridge.m

Worked for me

@mkonicek for the debugger? It's unfortunately still present https://github.com/facebook/react-native/issues/7659#issuecomment-221440732

+1 this is a very annoying issue.

@Elyx0 it also worked for me! thnx!

im on RN 0.26.2 running iOS app

This seems to be fixed in 0.27.0

Replace RCTBatchedBridge.m with the version in 0.25.1
https://github.com/facebook/react-native/blob/0.25-stable/React/Base/RCTBatchedBridge.m

Just read this again. It's a pretty bad one, sorry! Seems like a regression introduced in 0.26.

Is anyone still seeing this on 0.27, or 0.28.0-rc.0?

i am using the latest version 0.29. it seems that this issue still there, what do i do? please help. thanks

Updated to 0.29, no deadlock but no debugger anymore either And I get [RCTEventEmitter.m:52] SendingwebsocketFailedwith no listeners registered. in the console. Version from .25 of RCTBridge is sadly incompatible. Poke @mkonicek

I got following message as well when i replaced RCTBridge file with 0.25 version in 0.29 :
Class RCTEventEmitter was not exported. Did you forget to use RCT_EXPORT_MODULE()?
[RCTEventEmitter.m:52] Sending websocketFailed with no listeners registered.

0.30 everything works fine for me

Hi there! This issue is being closed because it has been inactive for a while.

But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/deadlockfreeze-with-native-modules-and-remote-debug-0260

Product Pains has been very useful in highlighting the top bugs and feature requests:
https://productpains.com/product/react-native?tab=top

Also, if this issue is a bug, please consider sending a pull request with a fix.

Was this page helpful?
0 / 5 - 0 ratings