hengsokchamroeun / javapns

Automatically exported from code.google.com/p/javapns
0 stars 0 forks source link

Occasional ArrayIndexOutOfBoundsException in queue when all threads are busy #85

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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 >= threads.size()) nextThread = 0;
        NotificationThread thread = threads.get(nextThread++);
        return thread;
    }

Original issue reported on code.google.com by gonz...@gmail.com on 22 Nov 2011 at 4:52

GoogleCodeExporter commented 8 years ago
Fixed in r338 (2.1.001).

Original comment by sype...@gmail.com on 22 Nov 2011 at 8:47

GoogleCodeExporter commented 8 years ago
Issue 100 has been merged into this issue.

Original comment by sype...@gmail.com on 16 Jan 2012 at 11:21

GoogleCodeExporter commented 8 years ago
Judging from the original post, this issue still exists in 2.1.1?

Original comment by Eventl...@gmail.com on 16 Jan 2012 at 11:24

GoogleCodeExporter commented 8 years ago
Issue 85 states that it was fixed in r338.  Have you tried the latest build?

Original comment by sype...@gmail.com on 16 Jan 2012 at 11:29

GoogleCodeExporter commented 8 years ago
I will try 2.1.1 when we are ready for the next server upgrade. Thanks for your 
help!

Original comment by Eventl...@gmail.com on 17 Jan 2012 at 2:39

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Make sure you try the latest BUILD, not just the latest released version....  
See the Requirements wiki page for info about nightly builds.

Original comment by sype...@gmail.com on 17 Jan 2012 at 4:28

GoogleCodeExporter commented 8 years ago
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)

Original comment by gregp...@gmail.com on 25 Feb 2013 at 2:58