zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec
Date Wed, 13 Dec 2017 22:10:00 GMT

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

ASF GitHub Bot commented on ZOOKEEPER-2338:
-------------------------------------------

Github user phunt commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/427#discussion_r156800318
  
    --- Diff: src/c/configure.ac ---
    @@ -130,18 +130,66 @@ main()
      else
        exit(0);
     }
    -], AC_MSG_RESULT(yes) 
    -   ipv6=yes, 
    -   AC_MSG_RESULT(no) 
    -   ipv6=no, 
    -   AC_MSG_RESULT(no) 
    +], AC_MSG_RESULT(yes)
    +   ipv6=yes,
    +   AC_MSG_RESULT(no)
    +   ipv6=no,
    +   AC_MSG_RESULT(no)
        ipv6=no)
     
     if test x"$ipv6" = xyes; then
       USEIPV6="-DZOO_IPV6_ENABLED"
       AC_SUBST(USEIPV6)
     fi
     
    +# use SOCK_CLOEXEC if available and wanted
    +AC_ARG_WITH([sock_cloexec],
    +[AS_HELP_STRING([--with-sock-cloexec],[build with SOCK_CLOEXEC flag set on the connections])],
    +[],[with_sock_cloexec=no])
    +
    +AC_MSG_CHECKING([whether SOCK_CLOEXEC is available])
    +
    +AC_TRY_RUN([ /* is SOCK_CLOEXEC available ? */
    +#include <sys/types.h>
    +#include <sys/socket.h>
    +#include <stdlib.h>
    +main()
    +{
    +#ifdef SOCK_CLOEXEC
    +  exit(0);
    +#else
    +  exit(1);
    +#endif
    +}
    +], AC_MSG_RESULT(yes)
    +   has_sock_cloexec=yes,
    +   AC_MSG_RESULT(no)
    +   has_sock_cloexec=no,
    +   AC_MSG_RESULT(no)
    +   has_sock_cloexec=no)
    +
    +if test "x$with_sock_cloexec" != xno && test "x$has_sock_cloexec" = xno; then
    +  AC_MSG_WARN([cannot use SOCK_CLOEXEC -- SOCK_CLOEXEC undefined on this platform])
    +  with_sock_cloexec=no
    +fi
    +
    +if test "x$with_sock_cloexec" != xno; then
    +AC_MSG_NOTICE([building with SOCK_CLOEXEC])
    +else
    +AC_MSG_NOTICE([building without SOCK_CLOEXEC])
    +fi
    +
    +AS_IF([test x"$with_sock_cloexec" != xno], [AC_DEFINE([SOCK_CLOEXEC_ENABLED], [1], [Define
to 1, if SOCK_CLOEXEC is defined and wanted])])
    +AM_CONDITIONAL([SOCK_CLOEXEC_ENABLED],[test "x$with_sock_cloexec" != xno])
    +
    +# Determine which libraries we need to use clock_gettime
    --- End diff --
    
    I believe you may have pulled this in by accident? It's not part of the 3.5/trunk patch.
Please remove this section (if I read that right).


> c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec
> ----------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-2338
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2338
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.5.3, 3.4.11, 3.6.0
>            Reporter: James DeFelice
>            Assignee: Radu Brumariu
>             Fix For: 3.5.4, 3.6.0
>
>
> I've observed socket FD leaks in Apache Mesos when using ZK to coordinate master leadership:
https://issues.apache.org/jira/browse/MESOS-4065



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message