harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Prashanth KS (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-6677) [classlib][concurrent] NegativeArraySizeException reported in ArrayBlockingQueue under load
Date Wed, 24 Nov 2010 10:02:13 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-6677?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12935275#action_12935275
] 

Prashanth KS commented on HARMONY-6677:
---------------------------------------

The extract() method is called by poll(), poll () with args and take(). 
The removeAt()  method is called by the remove() and the Iterator - remove()

The "count"  variable is decremented in both extract() and removeAt(). When I ran the test
using a stress engine, count got decremented and became negative. Please note that in some
of the above methods, an interruptible lock is used and has the chance of being woken up in
the middle, lets say when the count becomes 0. Meanwhile, another thread could get into the
extract(). Now without any condition checks here, I would get an NegativeArraySize exception,
which is what I got when I ran the multi-threaded tests.

So using the "count" condition clauses inside the extract() and the removeAt() seemed to be
the better option, rather than trying to implement these conditions in the calling methods.
Please let me know if you need the tests for these. I can send it to you offline.

> [classlib][concurrent] NegativeArraySizeException reported in ArrayBlockingQueue under
load
> -------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6677
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6677
>             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_6677.patch
>
>
> The extract() and the removeAt() methods in the ArrayBlockingQueue class do not have
a bounds check for the count variable and hence a NegativeArraySizeException is reported when
this class is load tested, with multiple threads.

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


Mime
View raw message