You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Vinayakumar B (JIRA)" <ji...@apache.org> on 2016/05/20 11:34:12 UTC

[jira] [Comment Edited] (HADOOP-13179) ToolRunner is not thread-safe because commons-cli OptionBuilder is not thread-safe

    [ https://issues.apache.org/jira/browse/HADOOP-13179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15293208#comment-15293208 ] 

Vinayakumar B edited comment on HADOOP-13179 at 5/20/16 11:33 AM:
------------------------------------------------------------------

I thought you can even make {{buildGeneralOptions()}} non-static and remove the SupressWarnings annotation.

Oops. Next second I realized, you cannot make it non-static and synchronized since we want to block multiple access to static {{OptionsBuilder}}. So {{buildGeneralOptions()}} has to be static, otherwise whole purpose of this jira will not be served.

Current fix works. +1.


was (Author: vinayrpet):
I think you can even make {{buildGeneralOptions()}} non-static and remove the SupressWarnings annotation, considering its private and called inside a non-static method.

> ToolRunner is not thread-safe because commons-cli OptionBuilder is not thread-safe
> ----------------------------------------------------------------------------------
>
>                 Key: HADOOP-13179
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13179
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: hongbin ma
>            Assignee: hongbin ma
>            Priority: Minor
>         Attachments: HADOOP-13179-master.patch, HADOOP-13179.001.patch
>
>
> I'm running into similar issues like http://stackoverflow.com/questions/22462665/is-hadoops-toorunner-thread-safe, the author's observation seem to make sense to me. However when I checked the hadoop github trunk I found the issue still not fixed.
> Chris Nauroth further investigated this issue, here's his quote: 
> {quote}
> The root cause is that commons-cli OptionBuilder is not thread-safe.
> https://commons.apache.org/proper/commons-cli/apidocs/org/apache/commons/cl
> i/OptionBuilder.html
> According to this issue, commons-cli doesn't plan to change that and
> instead chose to document the lack of thread-safety.
> https://issues.apache.org/jira/browse/CLI-209
> I think we can solve this in Hadoop, probably with a one-line change to
> make GenericOptionsParser#buildGeneralOptions a synchronized method.
> {quote}
> I'll soon upload a patch for this



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org