report a possible race issue

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

report a possible race issue

baigd
Hi, Developers of apache/camel,

I am writing to report a race issue on use of ConcurrentHashMap. The issue is reported by our tool in an automatic way. Although manually confirmed, it would be a false positive, given we do not know the specification of the program. We would very appreciate if you could check below for details and confirm with us whether it is a real problem. For more information, please refer to our website: http://sav.sutd.edu.sg/?page_id=2845

File:
"apache/camel/components/camel-guice/src/test/java/org/apache/camel/guice/testing/InjectorManager.java"
Location: Line (109/154,102/106)
Description:
The get-then-put operation in line 102 and 106 are guarded by the lock "injectors". I assume the intention is to guarantee the atomicity of the get-then-put operation so as to avoid unexpected data races. However, the write operations to injectors in line 109 and 154 may break this atomicity since they are not properly guarded by the same lock. Relying on the ConcurrentHashMap to ensure exclusive access is dangerous since ConcurrentHashMap has no guarantee of exclusive access.
Reply | Threaded
Open this post in threaded view
|

Re: report a possible race issue

Claus Ibsen-2
Hi

Thanks for reporting. I have removed that synchronized as it was not
needed to guard that during setup / tear down of the unit tests as
that happens single threaded anyway.

On Tue, Sep 22, 2015 at 6:37 AM, baigd <[hidden email]> wrote:

> Hi, Developers of apache/camel,
>
> I am writing to report a race issue on use of ConcurrentHashMap. The issue
> is reported by our tool in an automatic way. Although manually confirmed, it
> would be a false positive, given we do not know the specification of the
> program. We would very appreciate if you could check below for details and
> confirm with us whether it is a real problem. For more information, please
> refer to our website: http://sav.sutd.edu.sg/?page_id=2845
>
> File:
> "apache/camel/components/camel-guice/src/test/java/org/apache/camel/guice/testing/InjectorManager.java"
> Location: Line (109/154,102/106)
> Description:
> The get-then-put operation in line 102 and 106 are guarded by the lock
> "injectors". I assume the intention is to guarantee the atomicity of the
> get-then-put operation so as to avoid unexpected data races. However, the
> write operations to injectors in line 109 and 154 may break this atomicity
> since they are not properly guarded by the same lock. Relying on the
> ConcurrentHashMap to ensure exclusive access is dangerous since
> ConcurrentHashMap has no guarantee of exclusive access.
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/report-a-possible-race-issue-tp5771741.html
> Sent from the Camel Development mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: https://www.manning.com/books/ibsen2