Exception downloading Thread script to file.
See original GitHub issueIts 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:
- Created 5 years ago
- Reactions:4
- Comments:6 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any solutions to this? I am also having this issue.
@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 :
that the
getDevSupportManager
falsely recognises it as in production mode.