mwkirk / javapns

Test import of svn javapns repo from Google Code
3 stars 0 forks source link

Occasional ArrayIndexOutOfBoundsException in queue when all threads are busy #85

Closed mwkirk closed 11 years ago

mwkirk commented 11 years ago

Original author: gonz...@gmail.com (November 22, 2011 16:52:56)

What steps will reproduce the problem? Same as issue 84

What version of the product are you using? On what operating system? 2.1.1 stable

Please provide any additional information below.

I re-post my comment:

Hi! I was wrong on the correction. The problem was when all of the threads were busy. This fixed the code:

protected NotificationThread getNextAvailableThread() { for (int i = 0; i < threads.size(); i++) { NotificationThread thread = getNextThread(); boolean busy = thread.isBusy(); if (!busy) return thread; } return getNextThread(); /* All threads are busy, return the next one regardless of its busy status */ }

/**
 * Get the next thread to use.
 * 
 * @return a thread
 */
protected NotificationThread getNextThread() {
    if (nextThread &gt;= threads.size()) nextThread = 0;
    NotificationThread thread = threads.get(nextThread++);
    return thread;
}

Original issue: http://code.google.com/p/javapns/issues/detail?id=85

mwkirk commented 11 years ago

From sype...@gmail.com on November 22, 2011 20:47:12 Fixed in r338 (2.1.001).

mwkirk commented 11 years ago

From Eventl...@gmail.com on January 16, 2012 23:24:30 Judging from the original post, this issue still exists in 2.1.1?

mwkirk commented 11 years ago

From sype...@gmail.com on January 16, 2012 23:29:42 Issue 85 states that it was fixed in r338. Have you tried the latest build?

mwkirk commented 11 years ago

From Eventl...@gmail.com on January 17, 2012 02:39:23 I will try 2.1.1 when we are ready for the next server upgrade. Thanks for your help!

mwkirk commented 11 years ago

From sype...@gmail.com on January 17, 2012 04:28:44 Make sure you try the latest BUILD, not just the latest released version.... See the Requirements wiki page for info about nightly builds.

mwkirk commented 11 years ago

From gregp...@gmail.com on February 25, 2013 02:58:48 I'm running 2.2 and this is still happening:

java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0 at java.util.Vector.remove(Vector.java:804) at javapns.notification.PushedNotifications.prepareAdd(PushedNotifications.java:103) at javapns.notification.PushedNotifications.addAll(PushedNotifications.java:94) at javapns.notification.transmission.NotificationThreads.getPushedNotifications(NotificationThreads.java:402) at ly.cel.server.APNsManager.handlePushErrors(APNsManager.java:389) at ly.cel.server.APNsManager.pushCellMessageToClient(APNsManager.java:326) at ly.cel.notify.APNsMessageQueueManager.processCellMessage(APNsMessageQueueManager.java:90) at ly.cel.notify.APNsMessageQueueManager.processNewMessage(APNsMessageQueueManager.java:78) at ly.cel.notify.APNsMessageQueueManager.processNewMessage(APNsMessageQueueManager.java:28) at ly.cel.notify.HashedQueueManager.parseJSONAndExecute(HashedQueueManager.java:100) at ly.cel.notify.HashedQueueManager$HashedQueueConsumer.handleJSON(HashedQueueManager.java:120) at com.p2.alchemy.JSONConsumer$1.doTake(JSONConsumer.java:107) at com.p2.alchemy.JSONConsumer$1.run(JSONConsumer.java:56) at java.lang.Thread.run(Thread.java:679)