Giter Club home page Giter Club logo

Comments (22)

Traviskn avatar Traviskn commented on May 25, 2024 3

@VertaZoom Unfortunately you cannot have the remote debugger turned on while using react-native-threads. If you have turned on the remote debugger and run into this problem you will need to disable remote debugging from the development menu, and then you'll need to stop and restart the app by double pressing the home button and swiping it away. I currently recommend using a debugging tool like reactotron to work around this issue. See the example app in this repo for a reference on how to set that up, it is pretty simple to configure.

I'm hoping to find time soon to see if I can get better support for the built-in remote debugger working

from react-native-threads.

RafaelKr avatar RafaelKr commented on May 25, 2024 3

Are there any news on this? This is still an issue for me

from react-native-threads.

kesha-antonov avatar kesha-antonov commented on May 25, 2024 3

Same here

from react-native-threads.

Traviskn avatar Traviskn commented on May 25, 2024 1

@garrettm sorry to hear that, I would definitely recommend using the latest release of react-native-threads as we're working out the bugs.

Unfortunately right now running the remote debugger will cause crashes and I still need to research how to either stop the debugger from launching for the background thread, or get the debugger to support threads. I don't really know much more than you do at this point about how to do that.

For now my recommendation is to not run the remote debugger and instead use tools like Reactotron. Check out the example app to see the recommended debugging workflow.

I'll keep looking into this and keep you updated when I figure out how to make the remote debugger behave better.

from react-native-threads.

Traviskn avatar Traviskn commented on May 25, 2024

You don't need to run a second packager, I also see this error occasionally when the app tries to load the worker before packager has finished bundling it. When I get this error I look at the packager output in the terminal, wait until the progress bar finishes and then refresh my app.

from react-native-threads.

garrettm avatar garrettm commented on May 25, 2024

Thanks for your reply. I can check again next week, but it didn't seem to be an issue with the packager not being done yet, as it happens consistently, and I'm doing fairly extreme things to delay the startup (like a 15 second setTimeout to initialize the worker on launch). Can you think of anything else it might be? Or even a direction for me to look in? I'm familiar with debugging in xcode/objc and chrome, but unfamiliar with the RN native code base. I'm happy to root around if you give me a direction or things to look for.

from react-native-threads.

garrettm avatar garrettm commented on May 25, 2024

Also, thank you for making this ❤️

from react-native-threads.

Traviskn avatar Traviskn commented on May 25, 2024

Thanks @garrettm! I looked into this a bit more, and I'm able to consistently reproduce that error on iOS when remote debugging is enabled.

Interestingly, the error persists even after turning off remote debugging until I restart the app. Even reloading doesn't get rid of the error, I have kill the app by double pressing home button (pressing Command + Shift + H twice on the simulator) and swiping the app away.

When you see that error again, can you try dismissing the red screen, opening the dev menu, disabling remote debugging, restarting the app, and seeing if that resolves the issue? You might even need to uninstall and reinstall the app after disabling remote debugging.

I haven't been able to get remote debugging working with threads, so I use Reactotron for my debugging needs as mentioned in the README. It's definitely not ideal though, I would like to find some way to customize the dev menu to allow opening a remote debugger for both the main react native js process as well as any 'thread' js processes. I just haven't had the time yet to research how that would work.

from react-native-threads.

garrettm avatar garrettm commented on May 25, 2024

@Traviskn I've tried what you said. With the debugger turned off, it seems like I can use the app just fine until I call new Worker (where Worker = RNThread.Thread). Then the app becomes completely unresponsive, though the worker seems to be able to keep going (it keeps fetching images, and the UI updates with them). Once the app becomes unresponsive, I need to completely kill and restart the app (normal RN debug menu -> reload does not work).

Trying it again with the debugger on, the behavior seems roughly the same, except for what happens when I create a new RNThread is different. With the debugger on, I see the red screen, instead of the app becoming completely unresponsive. But otherwise, the symptoms are the same, I cannot use the app until I completely force-kill it and relaunch it.

I am using react-native 0.48.1, FYI.

Is there any way I could just make the worker threads not participate in debugging? I'd be fine with not being able to debug them, (other than posted log messages) if it meant that I could use them with the normal dev setup.

from react-native-threads.

Traviskn avatar Traviskn commented on May 25, 2024

@garrettm Dang, I'm not really sure what's going on then! I'm not sure I understand how the app is able to update the UI with images if it is also unresponsive. Would you be able to share any code samples with me that reproduce the issue for you? I'm also curious if you run into the same issues running the example app on iOS.

I personally am not able to successfully run the remote debugger with threads running, I have to use another tool like Reactotron. I would love to find some way to get the normal remote debugger working better, but for now my recommendation is to not turn on the remote debugger while running threads.

from react-native-threads.

garrettm avatar garrettm commented on May 25, 2024

@Traviskn is there any way I could tweak this package to opt out of debugging completely for threads? I'm assuming that would help the issue I'm seeing, and it would let me use the package without having to significantly add to my debugging setup.

from react-native-threads.

Traviskn avatar Traviskn commented on May 25, 2024

After looking around, it looks like this fork of react-native-workers has found a way to improve the iOS debugging situation:
jamesreggio/react-native-workers@d3644aa

I'll keep looking into this and see if that strategy will also work here, I would definitely love to get the built-in remote debugger working

from react-native-threads.

garrettm avatar garrettm commented on May 25, 2024

@Traviskn is there something I can help with? I am eager to spend some time to help make this work more cleanly, if you can tell me what you could use help with.

from react-native-threads.

garrettm avatar garrettm commented on May 25, 2024

For the record, this is with react-native 0.48.1 and react-native-threads 0.0.4

If these aren't expected to be compatible, I can upgrade one or both and try again.

from react-native-threads.

garrettm avatar garrettm commented on May 25, 2024

I am trying the react-native-workers package you linked, not having much more luck. As soon as I try to use the bridge, the app either red-boxes (with debugging enabled) or locks up (with debugging disabled) and then red-boxes shortly after that.

from react-native-threads.

garrettm avatar garrettm commented on May 25, 2024

@Traviskn thanks for your help, I'll probably poke around on working that out if I get a chance.

from react-native-threads.

garrettm avatar garrettm commented on May 25, 2024

@Traviskn FYI I have forked this repo: https://github.com/jamesreggio/react-native-workers

And disabled remote debugging for threads, and things seem to work on RN 0.50.1.
Here's my fork: https://github.com/garrettm/react-native-workers

(I used your SimpleExample for testing)

from react-native-threads.

Traviskn avatar Traviskn commented on May 25, 2024

Awesome, thanks for the heads up! I'll definitely check that out

from react-native-threads.

VertaZoom avatar VertaZoom commented on May 25, 2024

@Traviskn I have the same problem on RN 0.51.0. You could not solve it?

from react-native-threads.

 avatar commented on May 25, 2024

Hi @Traviskn, were you able to find any solution for this? I am still able to reproduce the same issue on RN 0.55.3 even with remote debugging disabled.

from react-native-threads.

Frexuz avatar Frexuz commented on May 25, 2024

Aw too bad. It's the only thing stopping me from using this. I use remote debugging all the time, and tbh, I don't like Reactotron that much :(

from react-native-threads.

danhowitt avatar danhowitt commented on May 25, 2024

This is an awesome project. I can live without debugging the worker threads, but the lack of support for running the debugger on the main thread is a bit of a deal breaker.

Does anyone have a solution?

from react-native-threads.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.