so we can spot if there are leaks.
plug two leaks for filedescriptors related to when sending ARP fail
and one leak when we can not parse the local address during tcp connection establish
return -1;
}
+ DEBUG(DEBUG_NOTICE, (__location__ " Created SOCKET FD:%d for sending arp\n", s));
strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name));
if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
DEBUG(DEBUG_CRIT,(__location__ " interface '%s' not found\n", iface));
+ close(s);
return -1;
}
ret = sendto(s, buffer, 64, 0, (struct sockaddr *)&sall, sizeof(sall));
if (ret < 0 ){
DEBUG(DEBUG_CRIT,(__location__ " failed sendto\n"));
+ close(s);
return -1;
}
return -1;
}
+ DEBUG(DEBUG_NOTICE, (__location__ " Created SOCKET FD:%d for sending arp\n", s));
strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name));
if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
DEBUG(DEBUG_CRIT,(__location__ " interface '%s' not found\n", iface));
+ close(s);
return -1;
}
return -1;
}
+ DEBUG(DEBUG_NOTICE, (__location__ " Created RAW SOCKET FD:%d for tcp tickle\n", s));
+
set_nonblocking(s);
set_close_on_exec(s);
set_nonblocking(fd);
set_close_on_exec(fd);
+ DEBUG(DEBUG_NOTICE,(__location__ " Created SOCKET FD:%d to connected child\n", fd));
+
client = talloc_zero(ctdb, struct ctdb_client);
#ifdef _AIX
if (getsockopt(fd, SOL_SOCKET, SO_PEERID, &cr, &crl) == 0) {
}
close(result->fd[1]);
+ set_close_on_exec(result->fd[0]);
+
+ DEBUG(DEBUG_NOTICE, (__location__ " Created PIPE FD:%d to child lockwait process\n", result->fd[0]));
+
talloc_set_destructor(result, lockwait_destructor);
result->fde = event_add_fd(ctdb_db->ctdb->ev, result, result->fd[0],
set_close_on_exec(p[0]);
ctdb->log->pfd = p[0];
+ DEBUG(DEBUG_NOTICE, (__location__ " Created PIPE FD:%d for logging\n", p[0]));
+
close(1);
close(2);
if (p[1] != 1) {
}
close(result->fd[1]);
+ set_close_on_exec(result->fd[0]);
+
talloc_set_destructor(result, childwrite_destructor);
+ DEBUG(DEBUG_NOTICE, (__location__ " Created PIPE FD:%d for ctdb_childwrite\n", result->fd[0]));
+
result->fde = event_add_fd(ctdb_db->ctdb->ev, result, result->fd[0],
EVENT_FD_READ|EVENT_FD_AUTOCLOSE, childwrite_handler,
(void *)result);
_exit(0);
}
close(state->fd[1]);
+ set_close_on_exec(state->fd[0]);
+
state->fd[1] = -1;
talloc_set_destructor(state, set_recmode_destructor);
+ DEBUG(DEBUG_NOTICE, (__location__ " Created PIPE FD:%d for setrecmode\n", state->fd[0]));
+
state->te = event_add_timed(ctdb->ev, state, timeval_current_ofs(5, 0),
ctdb_set_recmode_timeout, state);
}
close(state->fd[1]);
state->fd[1] = -1;
+ set_close_on_exec(state->fd[0]);
+
+ DEBUG(DEBUG_NOTICE, (__location__ " Created PIPE FD:%d for check_recovery_lock\n", state->fd[0]));
talloc_set_destructor(state, check_reclock_destructor);
exit(1);
}
+ DEBUG(DEBUG_NOTICE, (__location__ " Created PIPE FD:%d to recovery daemon\n", fd[0]));
+
event_add_fd(ctdb->ev, ctdb, fd[0], EVENT_FD_READ|EVENT_FD_AUTOCLOSE,
ctdb_recoverd_parent, &fd[0]);
}
close(h->fd[1]);
+ set_close_on_exec(h->fd[0]);
+
talloc_set_destructor(h, traverse_local_destructor);
DLIST_ADD(ctdb_db->traverse, h);
setup a packet queue between the child and the parent. This
copes with all the async and packet boundary issues
*/
+ DEBUG(DEBUG_NOTICE, (__location__ " Created PIPE FD:%d to child traverse\n", h->fd[0]));
+
h->queue = ctdb_queue_setup(ctdb_db->ctdb, h, h->fd[0], 0, ctdb_traverse_local_handler, h);
if (h->queue == NULL) {
talloc_free(h);
timeval_current_ofs(ctdb->tunable.vacuum_max_run_time, 0),
vacuum_child_timeout, child_ctx);
+ DEBUG(DEBUG_NOTICE, (__location__ " Created PIPE FD:%d to child vacuum process\n", child_ctx->fd[0]));
+
event_add_fd(ctdb->ev, child_ctx, child_ctx->fd[0],
EVENT_FD_READ|EVENT_FD_AUTOCLOSE,
vacuum_child_handler,
close(state->fd[1]);
set_close_on_exec(state->fd[0]);
+ DEBUG(DEBUG_NOTICE, (__location__ " Created PIPE FD:%d to child eventscript process\n", state->fd[0]));
+
event_add_fd(ctdb->ev, state, state->fd[0], EVENT_FD_READ|EVENT_FD_AUTOCLOSE,
ctdb_event_script_handler, state);
set_nonblocking(tnode->fd);
set_close_on_exec(tnode->fd);
+ DEBUG(DEBUG_NOTICE, (__location__ " Created TCP SOCKET FD:%d\n", tnode->fd));
+
/* Bind our side of the socketpair to the same address we use to listen
* on incoming CTDB traffic.
* We must specify this address to make sure that the address we expose to
*/
ZERO_STRUCT(sock_in);
if (ctdb_tcp_get_address(ctdb, ctdb->address.address, &sock_in) != 0) {
+ DEBUG(DEBUG_ERR, (__location__ " Failed to find our address. Failing bind.\n"));
+ close(tnode->fd);
return;
}
default:
DEBUG(DEBUG_ERR, (__location__ " unknown family %u\n",
sock_in.sa.sa_family));
+ close(tnode->fd);
return;
}
#ifdef HAVE_SOCK_SIN_LEN
set_nonblocking(in->fd);
set_close_on_exec(in->fd);
+ DEBUG(DEBUG_NOTICE, (__location__ " Created SOCKET FD:%d to incoming ctdb connection\n", fd));
+
setsockopt(in->fd,SOL_SOCKET,SO_KEEPALIVE,(char *)&one,sizeof(one));
in->queue = ctdb_queue_setup(ctdb, in, in->fd, CTDB_TCP_ALIGNMENT,