You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Prashanth KS (JIRA)" <ji...@apache.org> on 2010/11/18 07:06:13 UTC

[jira] Created: (HARMONY-6678) [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test

[classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test
--------------------------------------------------------------------------------------------------------

                 Key: HARMONY-6678
                 URL: https://issues.apache.org/jira/browse/HARMONY-6678
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
    Affects Versions: 6.0M3
         Environment: All Operating Systems
            Reporter: Prashanth KS
             Fix For: 6.0M3
         Attachments: 001_HARMONY_6678.patch

An ArrayIndexOutofBoundsException is thrown when the toArray(T[]) method is invoked, under load test with multiple threads. Concurrent updates to the collection results in changing Iterator sizes. As per the Javadocs, the result of the toArray(T[]) should return as much elements possible from the Collection. 

A toArray(T[]) method override has been implemented in ConcurrentSkipListSet and the bounds check has been included in the base class AbstractCollection to prevent this exception.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-6678) [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test

Posted by "Prashanth KS (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12965108#action_12965108 ] 

Prashanth KS commented on HARMONY-6678:
---------------------------------------

I am OK as long as this gets committed. Improvements can be committed after
adequate testing.

-- 
Regards
Prashanth




> [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6678
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6678
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 6.0M3
>         Environment: All Operating Systems
>            Reporter: Prashanth KS
>             Fix For: 6.0M3
>
>         Attachments: 001_HARMONY_6678.patch, 002_HARMONY_6678.patch
>
>
> An ArrayIndexOutofBoundsException is thrown when the toArray(T[]) method is invoked, under load test with multiple threads. Concurrent updates to the collection results in changing Iterator sizes. As per the Javadocs, the result of the toArray(T[]) should return as much elements possible from the Collection. 
> A toArray(T[]) method override has been implemented in ConcurrentSkipListSet and the bounds check has been included in the base class AbstractCollection to prevent this exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-6678) [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test

Posted by "Prashanth KS (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12935942#action_12935942 ] 

Prashanth KS commented on HARMONY-6678:
---------------------------------------

Hi Regis
Could you explain in detail about your comments?
1) Could the two level loops be simplified to one level?  Which two levels?
The while loop and the for loop? These levels have been introduced for
clearly demarcating the array resizing and the copy portions.

2) I had the same thought about making the trim method generic, but was also
having a thought on why we should be repeating the code in toArray() to
toArray(T[]). Moreover, the docs say,

"If this collection fits in the specified array with room to spare (i.e.,
the array has more elements than this collection), the element in the array
immediately following the end of the collection is set to null. (This is
useful in determining the length of this collection *only* if the caller
knows that this collection does not contain any null elements.) "

If I employ the array resizing technique, then I have to again add logic to
implement the above, because the arrays are resized perfectly as per the
above technique. The patch that I have provided takes care of this, though
it takes an extra copy. I will try to work this out and reduce the copy.

We can commit this patch for now and probably discuss the improvements of
these methods in a separate mail chain.

Thanks
Prashanth





-- 
Regards
Prashanth


> [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6678
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6678
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 6.0M3
>         Environment: All Operating Systems
>            Reporter: Prashanth KS
>             Fix For: 6.0M3
>
>         Attachments: 001_HARMONY_6678.patch, 002_HARMONY_6678.patch
>
>
> An ArrayIndexOutofBoundsException is thrown when the toArray(T[]) method is invoked, under load test with multiple threads. Concurrent updates to the collection results in changing Iterator sizes. As per the Javadocs, the result of the toArray(T[]) should return as much elements possible from the Collection. 
> A toArray(T[]) method override has been implemented in ConcurrentSkipListSet and the bounds check has been included in the base class AbstractCollection to prevent this exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-6678) [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test

Posted by "Regis Xu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12965105#action_12965105 ] 

Regis Xu commented on HARMONY-6678:
-----------------------------------

        while (iterator.hasNext()) {
            if (index == toArray.length) {
                toArray = trimOrAppend(toArray, toArray.length * 2 + 1);
            }
            for (; index < toArray.length; index++) {
                if (!iterator.hasNext()) {
                    return trimOrAppend(toArray, index);
                }
                toArray[index] = iterator.next();
            }
        } 

I think the inner 'for' loop could be avoid.

Because it's code freeze now, I'll apply patch after 5.0M16 released. Is it OK ?

> [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6678
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6678
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 6.0M3
>         Environment: All Operating Systems
>            Reporter: Prashanth KS
>             Fix For: 6.0M3
>
>         Attachments: 001_HARMONY_6678.patch, 002_HARMONY_6678.patch
>
>
> An ArrayIndexOutofBoundsException is thrown when the toArray(T[]) method is invoked, under load test with multiple threads. Concurrent updates to the collection results in changing Iterator sizes. As per the Javadocs, the result of the toArray(T[]) should return as much elements possible from the Collection. 
> A toArray(T[]) method override has been implemented in ConcurrentSkipListSet and the bounds check has been included in the base class AbstractCollection to prevent this exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-6678) [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test

Posted by "Prashanth KS (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-6678?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Prashanth KS updated HARMONY-6678:
----------------------------------

    Attachment: 001_HARMONY_6678.patch

> [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6678
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6678
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 6.0M3
>         Environment: All Operating Systems
>            Reporter: Prashanth KS
>             Fix For: 6.0M3
>
>         Attachments: 001_HARMONY_6678.patch
>
>
> An ArrayIndexOutofBoundsException is thrown when the toArray(T[]) method is invoked, under load test with multiple threads. Concurrent updates to the collection results in changing Iterator sizes. As per the Javadocs, the result of the toArray(T[]) should return as much elements possible from the Collection. 
> A toArray(T[]) method override has been implemented in ConcurrentSkipListSet and the bounds check has been included in the base class AbstractCollection to prevent this exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-6678) [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test

Posted by "Prashanth KS (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-6678?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Prashanth KS updated HARMONY-6678:
----------------------------------

    Attachment: 002_HARMONY_6678.patch

Changed the AbstractCollection class alone, as per the discussion with Regis.

> [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6678
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6678
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 6.0M3
>         Environment: All Operating Systems
>            Reporter: Prashanth KS
>             Fix For: 6.0M3
>
>         Attachments: 001_HARMONY_6678.patch, 002_HARMONY_6678.patch
>
>
> An ArrayIndexOutofBoundsException is thrown when the toArray(T[]) method is invoked, under load test with multiple threads. Concurrent updates to the collection results in changing Iterator sizes. As per the Javadocs, the result of the toArray(T[]) should return as much elements possible from the Collection. 
> A toArray(T[]) method override has been implemented in ConcurrentSkipListSet and the bounds check has been included in the base class AbstractCollection to prevent this exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-6678) [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12965173#action_12965173 ] 

Mark Hindess commented on HARMONY-6678:
---------------------------------------

We only have proposed dates for release and no release manager (well maybe we do now).  No dates have been confirmed for release and no code freezes have been announced.


> [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6678
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6678
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 6.0M3
>         Environment: All Operating Systems
>            Reporter: Prashanth KS
>             Fix For: 6.0M3
>
>         Attachments: 001_HARMONY_6678.patch, 002_HARMONY_6678.patch
>
>
> An ArrayIndexOutofBoundsException is thrown when the toArray(T[]) method is invoked, under load test with multiple threads. Concurrent updates to the collection results in changing Iterator sizes. As per the Javadocs, the result of the toArray(T[]) should return as much elements possible from the Collection. 
> A toArray(T[]) method override has been implemented in ConcurrentSkipListSet and the bounds check has been included in the base class AbstractCollection to prevent this exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-6678) [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test

Posted by "Regis Xu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12935239#action_12935239 ] 

Regis Xu commented on HARMONY-6678:
-----------------------------------

For patch 002_HARMONY_6678.patch:

        while (iterator.hasNext()) {
            if (index == toArray.length) {
                toArray = trimOrAppend(toArray, toArray.length * 2 + 1);
            }
            for (; index < toArray.length; index++) {
                if (!iterator.hasNext()) {
                    return trimOrAppend(toArray, index);
                }
                toArray[index] = iterator.next();
            }
        }

Could the two level loops be simplified to one level?

toArray(T[]) invoke toArray(), that make toArray(T[]) gets one more array copy operation than toArray(), I think generalizing trimOrAppend, and both toArray() and toArray(T[]) use it can reduce the extra copy.

> [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6678
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6678
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 6.0M3
>         Environment: All Operating Systems
>            Reporter: Prashanth KS
>             Fix For: 6.0M3
>
>         Attachments: 001_HARMONY_6678.patch, 002_HARMONY_6678.patch
>
>
> An ArrayIndexOutofBoundsException is thrown when the toArray(T[]) method is invoked, under load test with multiple threads. Concurrent updates to the collection results in changing Iterator sizes. As per the Javadocs, the result of the toArray(T[]) should return as much elements possible from the Collection. 
> A toArray(T[]) method override has been implemented in ConcurrentSkipListSet and the bounds check has been included in the base class AbstractCollection to prevent this exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.