hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Nauroth (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-6254) hdfsConnect segment fault where namenode not connected
Date Thu, 24 Apr 2014 18:13:19 GMT

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

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

[~huangkx], thanks again for the code sample.  I confirmed that the same behavior happens
for me: run the program directly and I get the expected connection failure error, but run
it under gdb and it dies with SIGSEGV.

I think the problem we're seeing is that the JVM actually traps SIGSEGV and runs its own signal
handler to attempt recovery.  This is part of how the JVM interacts with the kernel to manage
memory.  For example, see this code in OpenJDK:

http://hg.openjdk.java.net/jdk6/jdk6/hotspot/file/tip/src/os/linux/vm/os_linux.cpp#l3873

gdb's own signal handling appears to be interfering with this and choosing to suspend when
it encounters a SIGSEGV.  This doesn't really represent a bug in the libhdfs code.  In fact,
if I resume execution after the SIGSEGV by using the "fg" command, then it proceeds as expected,
and I see the connection failure.

If you don't want gdb to suspend when it sees a SIGSEGV, then another option is to change
its signal handling behavior by running this command:
{code}
(gdb) handle SIGSEGV nostop
{code}

BTW, I noticed a bug in the code sample you provided.  It does not call {{hdfsDisconnect}}
on the allocated {{hdfsFS}} to free resources.  This is something that you'll want to add
in your real code to avoid leaks.  Also note that the {{hdfsConnect}} function has been deprecated
in favor of {{hdfsBuilderConnect}}.  For full details on this, refer to the hdfs.h header
file.

At this point, I'm going to resolve this issue, because this behavior does not represent a
bug in the libhdfs code.  I hope this was helpful.

> 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
>
> When namenode is not started, the libhdfs client will cause segment fault while connecting.



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

Mime
View raw message