question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception downloading Thread script to file.

See original GitHub issue

Its not a RN 0.56 problem, rather actually putting the threads file in any Directory other than app root causes this.

const thread = new Thread('./services/contacts.js');
thread.onmessage = (message) => console.log(message);
Exception in native call
                              java.lang.RuntimeException: Exception downloading thread script to file
                                                                               at com.reactlibrary.RNThreadModule.downloadScriptToFileSync(RNThreadModule.java:220)
                                                                               at com.reactlibrary.RNThreadModule.createDevBundleLoader(RNThreadModule.java:175)
                                                                               at com.reactlibrary.RNThreadModule.startThread(RNThreadModule.java:68)
                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                               at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
                                                                               at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
                                                                               at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
                                                                               at android.os.Handler.handleCallback(Handler.java:751)
                                                                               at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                               at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
                                                                               at android.os.Looper.loop(Looper.java:154)
                                                                               at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
                                                                               at java.lang.Thread.run(Thread.java:761)
                                                                            Caused by: java.io.FileNotFoundException: /data/user/0/com.testproject/files/services/contacts (No such file or directory)
                                                                               at java.io.FileOutputStream.open(Native Method)
                                                                               at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
                                                                               at java.io.FileOutputStream.<init>(FileOutputStream.java:169)
                                                                               at okio.Okio.sink(Okio.java:181)
                                                                               at com.reactlibrary.RNThreadModule.downloadScriptToFileSync(RNThreadModule.java:217)
                                                                               at com.reactlibrary.RNThreadModule.createDevBundleLoader(RNThreadModule.java:175) 
                                                                               at com.reactlibrary.RNThreadModule.startThread(RNThreadModule.java:68) 
                                                                               at java.lang.reflect.Method.invoke(Native Method) 
                                                                               at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372) 
                                                                               at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160) 
                                                                               at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 
                                                                               at android.os.Handler.handleCallback(Handler.java:751) 
                                                                               at android.os.Handler.dispatchMessage(Handler.java:95) 
                                                                               at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29) 
                                                                               at android.os.Looper.loop(Looper.java:154) 
                                                                               at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192) 
                                                                               at java.lang.Thread.run(Thread.java:761) ```

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
tanmaybhattcommented, Sep 25, 2018

Any solutions to this? I am also having this issue.

0reactions
adhambadrcommented, Oct 3, 2018

@Traviskn yeah it happens in Dev didn’t try it yet in production. My solution was to simply “bundle” everything in the root of the app as “worker.threads.js” just as your exampleand that file imports the stuff needed from other folders, that works now. I tried to debug the native code to help out but couldn’t really reflect any changes as there was no clear “build” process documented, contrary to other native modules changing the Java files in my node_modules folder didn’t have any effect as I believe you pre-built the classes. But my guess would be something in these lines :

JSBundleLoader bundleLoader = getDevSupportManager().getDevSupportEnabled()
            ? createDevBundleLoader(jsFileName, jsFileSlug)
            : createReleaseBundleLoader(jsFileName, jsFileSlug);

that the getDevSupportManagerfalsely recognises it as in production mode.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - ThreadAbortException (WebClient using DownloadFile to ...
1) I get System.Threading.ThreadAbortException: Thread was being aborted in the server side try-catch block. Usually this was just a file not ...
Read more >
Thread was being aborted exception when downloading a file ...
File download from GridView rows in ASP.NET 4.0[^] ... This is normal. You can catch that specific exception and then ignore it.
Read more >
Creating DownloadHandlers - Unity - Manual
This is a special download handler for large files. It writes downloaded bytes directly to file, so the memory usage is low regardless...
Read more >
Thread - Android Developers
Implementation note: Java platform implementers are encouraged to document their implementation's behavior with respect to the stackSize parameter.
Read more >
Component Reference - Apache JMeter - User's Manual
When downloading a file, it can be stored on disk (Local File) or in the ... This sampler allows you to write a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found