Too many threads in Blackberry using Phonegap/WebWorks
Asked Answered
D

3

11

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!

Danilodanio answered 23/5, 2012 at 23:40 Comment(2)
Can you show (preferably code) how you're managing the threads.Farming
The problem is that you can't manage the threads. The code with phonegap usually is in plain javascript/html.Delgado
R
0

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/

Rather answered 16/6, 2012 at 23:7 Comment(0)
M
0

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

Merely answered 24/9, 2012 at 19:21 Comment(0)
H
0

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.

Holtz answered 4/12, 2014 at 16:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.