[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2018-01-18 Thread ASF GitHub Bot (JIRA)

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

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_r162510701
  
--- 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 
+#include 
+#include 
+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 --

@fr0stbyte I'd still like to get this committed - does my most recent 
comment make sense or am I missing something?


> 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
>Priority: Major
> 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
(v7.6.3#76005)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-15 Thread ASF GitHub Bot (JIRA)

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

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_r157325096
  
--- 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 
+#include 
+#include 
+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 --

Sorry I was unclear @fr0stbyte - I meant the following:

+# Determine which libraries we need to use clock_gettime
+saved_LIBS="$LIBS"
+LIBS=""
+AC_CHECK_LIB(rt, clock_gettime)
+CLOCK_GETTIME_LIBS=$LIBS
+AC_SUBST(CLOCK_GETTIME_LIBS)
+LIBS="$saved_LIBS"

those lines are included in this patch, but not #410 

Could you remove them? Or am I totally missing something?


> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-13 Thread ASF GitHub Bot (JIRA)

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

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

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

https://github.com/apache/zookeeper/pull/427#discussion_r156860284
  
--- 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 
+#include 
+#include 
+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 --

@phunt I think it was : 
https://github.com/apache/zookeeper/pull/410/files#diff-79599273360e5b5ede514927c8033356R182


> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-13 Thread ASF GitHub Bot (JIRA)

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

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_r156801636
  
--- 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 
+#include 
+#include 
+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 --

Aside from the the rest looks ok. Ready to commit once this item is 
addressed.


> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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 
+#include 
+#include 
+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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-12 Thread ASF GitHub Bot (JIRA)

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

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

Github user fr0stbyte commented on the issue:

https://github.com/apache/zookeeper/pull/427
  
@phunt thanks, will keep that in mind.


> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-12 Thread ASF GitHub Bot (JIRA)

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

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

Github user phunt commented on the issue:

https://github.com/apache/zookeeper/pull/427
  
@fr0stbyte in future I believe you need to update the commit message, that 
doesn't seem to be updated along with the PR description I'm afraid. (something 
to consider for future changes, I'll commit this as-is for now, esp as it 
matches what went into trunk...)


> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-12 Thread ASF GitHub Bot (JIRA)

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

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

Github user fr0stbyte commented on the issue:

https://github.com/apache/zookeeper/pull/427
  
@phunt @mfenes updated the initial comment of this PR. Let me know if you 
need me to move it into a separate comment


> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-12 Thread ASF GitHub Bot (JIRA)

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

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

Github user phunt commented on the issue:

https://github.com/apache/zookeeper/pull/427
  
For this one I'm fine with the whitespace as it also got into the trunk/3.5 
commit.

It's unfortunate that github doesn't have an option to remove whitespace 
changes from the diff they show but you can get around this by diffing the 
commit locally. (which is what I typically do)

Agree with @mfenes 's comment - even though this is a backport it's still 
nice to have. 

Thanks @fr0stbyte !


> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-11 Thread ASF GitHub Bot (JIRA)

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

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

Github user mfenes commented on the issue:

https://github.com/apache/zookeeper/pull/427
  
@fr0stbyte could you please add a description to your PR so that everybody 
could understand the purpose of this change?


> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-10 Thread ASF GitHub Bot (JIRA)

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

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

Github user anmolnar commented on the issue:

https://github.com/apache/zookeeper/pull/427
  
@fr0stbyte no thanks, that's fine, I've dug it out already.
Going forward I suggest to make linter / indentation / whitespace changes 
in a commit separate from the code changes.


> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-09 Thread ASF GitHub Bot (JIRA)

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

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

Github user fr0stbyte commented on the issue:

https://github.com/apache/zookeeper/pull/427
  
@anmolnar sorry, my editor is configured to strip the trailing white spaces 
. Do you need me to disable that?


> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-07 Thread Hadoop QA (JIRA)

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

Hadoop QA commented on ZOOKEEPER-2338:
--

+1 overall.  GitHub Pull Request  Build
  

+1 @author.  The patch does not contain any @author tags.

+0 tests included.  The patch appears to be a documentation patch that 
doesn't require tests.

+1 javadoc.  The javadoc tool did not generate any warning messages.

+1 javac.  The applied patch does not increase the total number of javac 
compiler warnings.

+1 findbugs.  The patch does not introduce any new Findbugs (version 3.0.1) 
warnings.

+1 release audit.  The applied patch does not increase the total number of 
release audit warnings.

+1 core tests.  The patch passed core unit tests.

+1 contrib tests.  The patch passed contrib unit tests.

Test results: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1336//testReport/
Findbugs warnings: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1336//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1336//console

This message is automatically generated.

> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-07 Thread ASF GitHub Bot (JIRA)

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

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

GitHub user fr0stbyte opened a pull request:

https://github.com/apache/zookeeper/pull/427

[ZOOKEEPER-2338] - set SOCK_CLOEXEC on socket if defined

@phunt @anmolnar 
PR for 3.4 branch.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/fr0stbyte/zookeeper 
fr0stbyte/ZOOKEEPER-2338-3.4

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/zookeeper/pull/427.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #427


commit 025142999b3fee596d6f41d63e0076582cca539f
Author: Radu Brumariu 
Date:   2017-10-25T18:24:17Z

[ZOOKEEPER-2338] - set SOCK_CLOEXEC on socket if defined




> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-06 Thread Hudson (JIRA)

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

Hudson commented on ZOOKEEPER-2338:
---

SUCCESS: Integrated in Jenkins build ZooKeeper-trunk #3646 (See 
[https://builds.apache.org/job/ZooKeeper-trunk/3646/])
ZOOKEEPER-2338: set SOCK_CLOEXEC on socket if defined (phunt: rev 
665038e0698cd471a25b7ead4c8a50f767a3e7ed)
* (edit) src/c/configure.ac
* (edit) src/c/cmake_config.h.in
* (edit) src/c/CMakeLists.txt
* (edit) src/c/src/zookeeper.c


> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-06 Thread ASF GitHub Bot (JIRA)

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

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

Github user phunt commented on the issue:

https://github.com/apache/zookeeper/pull/410
  
Committed to branch-3.5 and master. I tried applying to branch-3.4 but it 
wouldn't apply cleanly. Please submit another pull request for 3.4 and I'll 
review/commit that as well. Thanks @fr0stbyte !


> 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
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-06 Thread ASF GitHub Bot (JIRA)

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

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

Github user asfgit closed the pull request at:

https://github.com/apache/zookeeper/pull/410


> 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
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-06 Thread ASF GitHub Bot (JIRA)

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

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

Github user phunt commented on the issue:

https://github.com/apache/zookeeper/pull/410
  
I tested it with cmake and autotools based generation and the command lines 
work properly with agreed upon defaults. LGTM. +1.


> 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
>Reporter: James DeFelice
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-06 Thread ASF GitHub Bot (JIRA)

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

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

Github user anmolnar commented on the issue:

https://github.com/apache/zookeeper/pull/410
  
@fr0stbyte According to my tiny C knowledge, it looks good to me.


> 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
>Reporter: James DeFelice
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-12-05 Thread ASF GitHub Bot (JIRA)

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

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

Github user fr0stbyte commented on the issue:

https://github.com/apache/zookeeper/pull/410
  
@phunt @anmolnar any suggestion on changes or does this look good ?


> 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
>Reporter: James DeFelice
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-11-27 Thread Hadoop QA (JIRA)

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

Hadoop QA commented on ZOOKEEPER-2338:
--

-1 overall.  GitHub Pull Request  Build
  

+1 @author.  The patch does not contain any @author tags.

+0 tests included.  The patch appears to be a documentation patch that 
doesn't require tests.

+1 javadoc.  The javadoc tool did not generate any warning messages.

+1 javac.  The applied patch does not increase the total number of javac 
compiler warnings.

+1 findbugs.  The patch does not introduce any new Findbugs (version 3.0.1) 
warnings.

+1 release audit.  The applied patch does not increase the total number of 
release audit warnings.

-1 core tests.  The patch failed core unit tests.

+1 contrib tests.  The patch passed contrib unit tests.

Test results: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1314//testReport/
Findbugs warnings: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1314//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1314//console

This message is automatically generated.

> 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
>Reporter: James DeFelice
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-11-27 Thread ASF GitHub Bot (JIRA)

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

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

Github user fr0stbyte commented on the issue:

https://github.com/apache/zookeeper/pull/410
  
@phunt Let me know if the changes are inline with what you've had in mind. 
Once we clear that, I will add the changes for 3.6


> 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
>Reporter: James DeFelice
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-11-21 Thread ASF GitHub Bot (JIRA)

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

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

Github user fr0stbyte commented on the issue:

https://github.com/apache/zookeeper/pull/410
  
@phunt both options seem fine to me. I think would prefer the first one, 
that way if the library remains ABI compatible, the clients won't need to 
recompile.



> 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
>Reporter: James DeFelice
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-11-16 Thread ASF GitHub Bot (JIRA)

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

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

Github user phunt commented on the issue:

https://github.com/apache/zookeeper/pull/410
  
> I am not sure how

Yea, same here I'm afraid.

In thinking about it a bit perhaps what we could do is one of the following 
two option (might be more):

1)  add it with some extra tooling in autoconf (and probably now cmake 
since it was recently introduced). Basically: add a new flag that the user 
(person compiling the library) could use to enable/disable SOCK_CLOEXEC when 
running ./configure.

In 3.5 the default behavior would be to not use SOCK_CLOEXEC regardless 
whether it's supported or not (user can override default with the option). In 
3.6 and later we'd make SOCK_CLOEXEC the default and call it out as a potential 
issue as part of the release notes (disable with the option in this case).

2) it seems like we could do similar with a runtime property that the user 
could set in code prior to running zookeeper_init that would be global in 
nature. e.g. zoo_deterministic_conn_order

Again the defaults would be as specified in 1) above.

Thoughts?




> 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
>Reporter: James DeFelice
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-11-15 Thread ASF GitHub Bot (JIRA)

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

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

Github user fr0stbyte commented on the issue:

https://github.com/apache/zookeeper/pull/410
  
@phunt I'd have no problem making in backward compatible, but I am not sure 
how. Can you offer some guidance here ?
@anmolnar In the description of MESOS-4065 you can see 2 processes that 
share the same open file descriptor. In Linux ( Unix in general ) upon forking, 
the child inherits all the open files of the parent, unless the O_CLOEXEC 
option has been set on the file descriptor. My change uses the SOCK_CLOEXEC 
which is an atomic set of that flag. The alternative is to open it and then use 
`fcntl` to set the flag, but that leaves space for a race as a process could 
fork before.
Since the child process does not need / makes use of the open file 
descriptor it is proper to close it before exec'ing. I wouldn't say it's a 
functional bug, but rather good housekeeping ( afaict ).
@afine I think in order to reproduce it, you need a process that uses the C 
client, then that forks and execs something else. To verify, look at the open 
file descriptors for the 2 processes and verify that the open socket to 
zookeeper is not available in the child.


> 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
>Reporter: James DeFelice
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-11-15 Thread ASF GitHub Bot (JIRA)

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

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

Github user phunt commented on the issue:

https://github.com/apache/zookeeper/pull/410
  
This looks like a non-backward compatible change to me. That said I'm not 
sure how many clients would rely on this behavior. thoughts?


> 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
>Reporter: James DeFelice
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-11-03 Thread ASF GitHub Bot (JIRA)

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

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

Github user anmolnar commented on the issue:

https://github.com/apache/zookeeper/pull/410
  
@fr0stbyte Reading some Stackoverflow about the flag 
(https://stackoverflow.com/questions/22304631/what-is-the-purpose-to-set-sock-cloexec-flag-with-accept4-same-as-o-cloexec),
 the change looks reasonable to me. However it would be beneficial to shed some 
light on how it's related to your scenario.


> 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
>Reporter: James DeFelice
>Priority: Major
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-11-02 Thread ASF GitHub Bot (JIRA)

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

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

Github user afine commented on the issue:

https://github.com/apache/zookeeper/pull/410
  
@fr0stbyte Thanks for linking to the Mesos bug. Unfortunately, I am not 
familiar with the way Mesos handles processes and I think it is possible that 
other members of the community share my ignorance.

Would you mind describing the conditions that are necessary to reproduce 
this bug?


> 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
>Reporter: James DeFelice
>Priority: Major
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-11-01 Thread ASF GitHub Bot (JIRA)

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

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

Github user fr0stbyte commented on the issue:

https://github.com/apache/zookeeper/pull/410
  
@afine Thanks for looking at the PR
Here is the bug tracked on Mesos side : 
https://issues.apache.org/jira/browse/MESOS-4065



> 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
>Reporter: James DeFelice
>Priority: Major
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-10-27 Thread ASF GitHub Bot (JIRA)

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

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

Github user afine commented on the issue:

https://github.com/apache/zookeeper/pull/410
  
Hi @fr0stbyte 

I see in the JIRA that this ticked arises from an issue related to running 
ZooKeeper Mesos. Would you be able to explain exactly why this is needed?


> 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
>Reporter: James DeFelice
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-10-27 Thread Hadoop QA (JIRA)

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

Hadoop QA commented on ZOOKEEPER-2338:
--

-1 overall.  GitHub Pull Request  Build
  

+1 @author.  The patch does not contain any @author tags.

+0 tests included.  The patch appears to be a documentation patch that 
doesn't require tests.

+1 javadoc.  The javadoc tool did not generate any warning messages.

+1 javac.  The applied patch does not increase the total number of javac 
compiler warnings.

+1 findbugs.  The patch does not introduce any new Findbugs (version 3.0.1) 
warnings.

+1 release audit.  The applied patch does not increase the total number of 
release audit warnings.

-1 core tests.  The patch failed core unit tests.

+1 contrib tests.  The patch passed contrib unit tests.

Test results: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1125//testReport/
Findbugs warnings: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1125//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1125//console

This message is automatically generated.

> 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
>Reporter: James DeFelice
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-10-27 Thread ASF GitHub Bot (JIRA)

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

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

GitHub user fr0stbyte opened a pull request:

https://github.com/apache/zookeeper/pull/410

[ZOOKEEPER-2338] - set SOCK_CLOEXEC on socket if defined



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/fr0stbyte/zookeeper ZOOKEEPER-2338

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/zookeeper/pull/410.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #410


commit e7fb9fc9fb0140c35869af255d39e643597b517c
Author: Radu Brumariu 
Date:   2017-10-25T18:24:17Z

[ZOOKEEPER-2338] - set SOCK_CLOEXEC on socket if defined




> 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
>Reporter: James DeFelice
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-10-27 Thread ASF GitHub Bot (JIRA)

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

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

Github user fr0stbyte closed the pull request at:

https://github.com/apache/zookeeper/pull/407


> 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
>Reporter: James DeFelice
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-10-26 Thread Hadoop QA (JIRA)

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

Hadoop QA commented on ZOOKEEPER-2338:
--

-1 overall.  GitHub Pull Request  Build
  

+1 @author.  The patch does not contain any @author tags.

+0 tests included.  The patch appears to be a documentation patch that 
doesn't require tests.

+1 javadoc.  The javadoc tool did not generate any warning messages.

+1 javac.  The applied patch does not increase the total number of javac 
compiler warnings.

+1 findbugs.  The patch does not introduce any new Findbugs (version 3.0.1) 
warnings.

+1 release audit.  The applied patch does not increase the total number of 
release audit warnings.

-1 core tests.  The patch failed core unit tests.

+1 contrib tests.  The patch passed contrib unit tests.

Test results: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1122//testReport/
Findbugs warnings: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1122//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1122//console

This message is automatically generated.

> 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
>Reporter: James DeFelice
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-10-25 Thread Hadoop QA (JIRA)

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

Hadoop QA commented on ZOOKEEPER-2338:
--

-1 overall.  GitHub Pull Request  Build
  

+1 @author.  The patch does not contain any @author tags.

+0 tests included.  The patch appears to be a documentation patch that 
doesn't require tests.

+1 javadoc.  The javadoc tool did not generate any warning messages.

+1 javac.  The applied patch does not increase the total number of javac 
compiler warnings.

+1 findbugs.  The patch does not introduce any new Findbugs (version 3.0.1) 
warnings.

+1 release audit.  The applied patch does not increase the total number of 
release audit warnings.

-1 core tests.  The patch failed core unit tests.

+1 contrib tests.  The patch passed contrib unit tests.

Test results: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1120//testReport/
Findbugs warnings: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1120//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1120//console

This message is automatically generated.

> 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
>Reporter: James DeFelice
>
> 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)


[jira] [Commented] (ZOOKEEPER-2338) c bindings should create socket's with SOCK_CLOEXEC to avoid fd leaks on fork/exec

2017-10-25 Thread ASF GitHub Bot (JIRA)

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

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

GitHub user fr0stbyte opened a pull request:

https://github.com/apache/zookeeper/pull/407

[ZOOKEEPER-2338] - set SOCK_CLOEXEC on socket if defined

This addresses the issue in 
https://issues.apache.org/jira/browse/ZOOKEEPER-2338 preventing the sockets to 
leak into the forked children 

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/fr0stbyte/zookeeper radu/cloexec_on_c_client

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/zookeeper/pull/407.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #407


commit 431742cd8f1726c17e3afdedf553b79663294177
Author: Radu Brumariu 
Date:   2017-10-25T18:24:17Z

[ZOOKEEPER-2338] - set SOCK_CLOEXEC on socket if defined




> 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
>Reporter: James DeFelice
>
> 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)