summaryrefslogtreecommitdiff
path: root/server-tools
diff options
context:
space:
mode:
authoranozdrin/alik@alik. <>2006-09-01 18:20:33 +0400
committeranozdrin/alik@alik. <>2006-09-01 18:20:33 +0400
commit725bb2e6aff9054678e2aa5872a1fca271146f47 (patch)
tree9efd24b8e127df6dfa89266d796edacb15e4eb70 /server-tools
parentbddfef1e360e8c511d801e084ea6a1b466f5dd90 (diff)
downloadmariadb-git-725bb2e6aff9054678e2aa5872a1fca271146f47.tar.gz
Fix for BUG#12751: Instance Manager: client hangs after
start instance; kill mysqlmanager; show ... The problem was that Instance Manager didn't close client sockets (sockets for client connections) on execing mysqld instance. So, mysqld-instance inherits these descriptors. The fix is to set close-on-exec flag for each client socket.
Diffstat (limited to 'server-tools')
-rw-r--r--server-tools/instance-manager/listener.cc42
1 files changed, 23 insertions, 19 deletions
diff --git a/server-tools/instance-manager/listener.cc b/server-tools/instance-manager/listener.cc
index 500b25bec03..58a4093dd05 100644
--- a/server-tools/instance-manager/listener.cc
+++ b/server-tools/instance-manager/listener.cc
@@ -36,6 +36,27 @@
#include "portability.h"
+static void set_non_blocking(int socket)
+{
+#ifndef __WIN__
+ int flags= fcntl(socket, F_GETFL, 0);
+ fcntl(socket, F_SETFL, flags | O_NONBLOCK);
+#else
+ u_long arg= 1;
+ ioctlsocket(socket, FIONBIO, &arg);
+#endif
+}
+
+
+static void set_no_inherit(int socket)
+{
+#ifndef __WIN__
+ int flags= fcntl(socket, F_GETFD, 0);
+ fcntl(socket, F_SETFD, flags | FD_CLOEXEC);
+#endif
+}
+
+
/*
Listener_thread - incapsulates listening functionality
*/
@@ -157,6 +178,8 @@ void Listener_thread::run()
/* accept may return -1 (failure or spurious wakeup) */
if (client_fd >= 0) // connection established
{
+ set_no_inherit(client_fd);
+
Vio *vio= vio_new(client_fd, socket_index == 0 ?
VIO_TYPE_SOCKET : VIO_TYPE_TCPIP,
socket_index == 0 ? 1 : 0);
@@ -198,25 +221,6 @@ err:
return;
}
-void set_non_blocking(int socket)
-{
-#ifndef __WIN__
- int flags= fcntl(socket, F_GETFL, 0);
- fcntl(socket, F_SETFL, flags | O_NONBLOCK);
-#else
- u_long arg= 1;
- ioctlsocket(socket, FIONBIO, &arg);
-#endif
-}
-
-void set_no_inherit(int socket)
-{
-#ifndef __WIN__
- int flags= fcntl(socket, F_GETFD, 0);
- fcntl(socket, F_SETFD, flags | FD_CLOEXEC);
-#endif
-}
-
int Listener_thread::create_tcp_socket()
{
/* value to be set by setsockopt */