简体   繁体   中英

Too many threads in Blackberry using Phonegap/WebWorks

I am developing a Blackberry app using Cordova/PhoneGap . I am fetching several images (map tiles) from a server. Also, every 60 seconds I send position information to it.

However, every now and then either when I fetch the images or send information, I get an error. If I am on a simulator (BB 9930, OS 7.0.0.318), I get an AppError 104: Too many threads message and my app crashes. When I test my app on a device (BB 8520, OS 5.0.0.592) not only does the app crashes, but makes the BB reset.

I have seen other posts with the same issue (like this one , this one or this one ). However, I haven't found a solution when building the app using Cordova/PhoneGap (JavaScript).

Thanks!

This may not be related, but I did have a similar problem when doing a lot of request from a native app on a BB Bold. The connection thread was not closed properly after receiving the answer.

try the following:

  • change GET <-> POST.
  • change HTTP <-> HTTPS.

if the server is yours, evaluate changing the API to return all the images as one and use an offset/clipping when displaying them. You will save bandwidth and open less connections. your app will load faster.

eg: http://www.ibloomstudios.com/articles/misunderstood_css_clip/

I doubt if the phoneGap API is causing this as it is basically a layer. Possibly you have an issue with the simulator?

Since you are also testing on Blackberry 8520, It is recommended that you keep the MAX number of threads - running concurrently- at any point of time in your application - less than 12

Since you are using Phonegap, chances are that it may be initiating those threads for your application.

If the device is connected to your system, connect it to Blackberry JDE and see, which threads are active to analyse if you can reschedule your tasks.

Are you using AJAX to get the map tiles and send location to your server?

If you are using AJAX, then you can keep a counter in JavaScript to keep a check on the requests.

Also, have you tried WebWorkers , they would enable you to do all of them within single thread itself.

If all fails, you can also develop your custom Phonegap plugin to do similar things with a Java Script interface API.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM