[jboss-dev] Thread safety problems

Brian Stansberry brian.stansberry at redhat.com
Fri Apr 17 17:33:45 EDT 2009


Scott Marlow wrote:
> Anil Saldhana wrote:
>> Jason T. Greene wrote:
>>> David M. Lloyd wrote:
>>>> When writing an API or SPI it is absolutely critical that all the 
>>>> elements of that API or SPI are thoroughly documented with any 
>>>> information related to the thread safety (or lack thereof) of that 
>>>> element.  We have a great deal of code (and I'm talking critical, 
>>>> core stuff) out there with little or no javadoc at all, let alone 
>>>> thread safety information in said documentation.  This creates the 
>>>> possibility for situations like SPIs which can end up being 
>>>> implemented with completely wrong thread safety semantics, basically 
>>>> leaving time bombs in the code.  See 
>>>> http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4226025 for 
>>>> one recent example.
>>>>
>>>> We still have way too much code doing double-checked locking, or 
>>>> using locks in strange or non-optimal ways, or using thread 
>>>> interruption wrong, or making wrong assumptions about the JMM.  Own 
>>>> and read this book: http://jcip.net/ - don't think you understand 
>>>> concurrency until you have done so - seriously.
>>>
>>> Well said. Every contributor should read this book, it is essential 
>>> knowledge.
>>>
>>> I will also add that all new designs/enhancements must take thread 
>>> interaction into consideration. It is much harder to retrofit an 
>>> existing API/implementation to be safe and efficient after it has 
>>> been completed.
>>>
>>> If you aren't sure how to solve a threading problem, or want to 
>>> validate your design please ask here or on the forums! We have many 
>>> experts in this area.
>> Should we also maybe start a "Best Practices" wiki article or such for 
>> folks to review often? It is just not thread safety that we need to be 
>> worried. Things such as privileged blocks also need to be taught.  
>> JCIP is one of the best books I have ever read. :)

Agreed. Can you recommend anything similar security-related?

>>
> 
> http://www.jboss.org/community/docs/DOC-12399 has some thread safety 
> thoughts.  Perhaps others could be added.
> 

Good stuff. :)

>> We have got to continue and enhance the culture of design discussions 
>> and the use of this development list. :)

+10.

>> _______________________________________________
>> jboss-development mailing list
>> jboss-development at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jboss-development
>>
> 
> _______________________________________________
> jboss-development mailing list
> jboss-development at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-development


-- 
Brian Stansberry
Lead, AS Clustering
JBoss, a division of Red Hat
brian.stansberry at redhat.com



More information about the jboss-development mailing list