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

Chris Nauroth commented on HDFS-6254:
-------------------------------------

Regarding this line of code:

{code}
                fs = hdfsBuilderConnect(bld);    //core dump here
{code}

This is attempting to use a {{hdfsBuilder}} that had already been used in an 
earlier {{hdfsBuilderConnect}} call.  This is invalid usage and could very well 
produce a segfault.  The docs for {{hdfsBuilderConnect}} state that it always 
frees the builder, regardless of the outcome:

{code}
     * The HDFS builder will be freed, whether or not the connection was
     * successful.
{code}

Related to this, the docs for {{hdfsFreeBuilder}} state that you normally 
wouldn't need to call it directly:

{code}
     * It is normally not necessary to call this function since
     * hdfsBuilderConnect frees the builder.
{code}

The only time you'd need to call {{hdfsFreeBuilder}} yourself directly is if 
you allocated one by calling {{hdfsNewBuilder}}, but then never called 
{{hdfsBuilderConnect}}.  I don't see a path through your code sample that can 
cause that to happen, so I expect you can remove the null checks on {{bld}} 
followed by the calls to {{hdfsFreeBuilder}}.

If there are any additional libhdfs usage questions, I recommend emailing 
u...@hadoop.apache.org.  This is the best venue for support.  Jira is intended 
for reporting of bugs only, and in this case, we haven't seen any actual bugs 
in libhdfs.

> hdfsConnect segment fault where namenode not connected
> ------------------------------------------------------
>
>                 Key: HDFS-6254
>                 URL: https://issues.apache.org/jira/browse/HDFS-6254
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: libhdfs
>    Affects Versions: 2.2.0
>         Environment: Linux Centos 64bit
>            Reporter: huang ken
>            Assignee: Chris Nauroth
>         Attachments: test.cpp
>
>
> When namenode is not started, the libhdfs client will cause segment fault 
> while connecting.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to