projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bump version to 2.4.0-pre1
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
main.c
diff --git
a/src/bin/lttng-sessiond/main.c
b/src/bin/lttng-sessiond/main.c
index 6c6386d2b3b1107255260110175743fa04ccf9bf..b665deaac1dfe851e4fd82a19c59177a72945e64 100644
(file)
--- a/
src/bin/lttng-sessiond/main.c
+++ b/
src/bin/lttng-sessiond/main.c
@@
-690,9
+690,6
@@
static int update_kernel_stream(struct consumer_data *consumer_data, int fd)
rcu_read_lock();
cds_lfht_for_each_entry(ksess->consumer->socks->ht,
&iter.iter, socket, node.node) {
rcu_read_lock();
cds_lfht_for_each_entry(ksess->consumer->socks->ht,
&iter.iter, socket, node.node) {
- /* Code flow error */
- assert(socket->fd);
-
pthread_mutex_lock(socket->lock);
ret = kernel_consumer_send_channel_stream(socket,
channel, ksess,
pthread_mutex_lock(socket->lock);
ret = kernel_consumer_send_channel_stream(socket,
channel, ksess,
@@
-1024,13
+1021,14
@@
restart:
lttcomm_connect_unix_sock(consumer_data->cmd_unix_sock_path);
consumer_data->metadata_fd =
lttcomm_connect_unix_sock(consumer_data->cmd_unix_sock_path);
lttcomm_connect_unix_sock(consumer_data->cmd_unix_sock_path);
consumer_data->metadata_fd =
lttcomm_connect_unix_sock(consumer_data->cmd_unix_sock_path);
- if (consumer_data->cmd_sock < 0 || consumer_data->metadata_fd < 0) {
+ if (consumer_data->cmd_sock < 0
+ || consumer_data->metadata_fd < 0) {
PERROR("consumer connect cmd socket");
/* On error, signal condition and quit. */
signal_consumer_condition(consumer_data, -1);
goto error;
}
PERROR("consumer connect cmd socket");
/* On error, signal condition and quit. */
signal_consumer_condition(consumer_data, -1);
goto error;
}
- consumer_data->metadata_sock.fd = &consumer_data->metadata_fd;
+ consumer_data->metadata_sock.fd
_ptr
= &consumer_data->metadata_fd;
/* Create metadata socket lock. */
consumer_data->metadata_sock.lock = zmalloc(sizeof(pthread_mutex_t));
if (consumer_data->metadata_sock.lock == NULL) {
/* Create metadata socket lock. */
consumer_data->metadata_sock.lock = zmalloc(sizeof(pthread_mutex_t));
if (consumer_data->metadata_sock.lock == NULL) {
@@
-1143,8
+1141,8
@@
exit:
error:
/*
* We lock here because we are about to close the sockets and some other
error:
/*
* We lock here because we are about to close the sockets and some other
- * thread might be using them so
wait before we are exclusive which wi
ll
- *
abort all
other consumer command by other threads.
+ * thread might be using them so
get exclusive access which will abort a
ll
+ * other consumer command by other threads.
*/
pthread_mutex_lock(&consumer_data->lock);
*/
pthread_mutex_lock(&consumer_data->lock);
@@
-1173,8
+1171,8
@@
error:
}
consumer_data->cmd_sock = -1;
}
}
consumer_data->cmd_sock = -1;
}
- if (*consumer_data->metadata_sock.fd >= 0) {
- ret = close(*consumer_data->metadata_sock.fd);
+ if (*consumer_data->metadata_sock.fd
_ptr
>= 0) {
+ ret = close(*consumer_data->metadata_sock.fd
_ptr
);
if (ret) {
PERROR("close");
}
if (ret) {
PERROR("close");
}
@@
-1191,6
+1189,7
@@
error:
unlink(consumer_data->cmd_unix_sock_path);
consumer_data->pid = 0;
pthread_mutex_unlock(&consumer_data->lock);
unlink(consumer_data->cmd_unix_sock_path);
consumer_data->pid = 0;
pthread_mutex_unlock(&consumer_data->lock);
+
/* Cleanup metadata socket mutex. */
pthread_mutex_destroy(consumer_data->metadata_sock.lock);
free(consumer_data->metadata_sock.lock);
/* Cleanup metadata socket mutex. */
pthread_mutex_destroy(consumer_data->metadata_sock.lock);
free(consumer_data->metadata_sock.lock);
@@
-1378,6
+1377,9
@@
error_testpoint:
* Send a socket to a thread This is called from the dispatch UST registration
* thread once all sockets are set for the application.
*
* Send a socket to a thread This is called from the dispatch UST registration
* thread once all sockets are set for the application.
*
+ * The sock value can be invalid, we don't really care, the thread will handle
+ * it and make the necessary cleanup if so.
+ *
* On success, return 0 else a negative value being the errno message of the
* write().
*/
* On success, return 0 else a negative value being the errno message of the
* write().
*/
@@
-1385,9
+1387,14
@@
static int send_socket_to_thread(int fd, int sock)
{
int ret;
{
int ret;
- /* Sockets MUST be set or else this should not have been called. */
- assert(fd >= 0);
- assert(sock >= 0);
+ /*
+ * It's possible that the FD is set as invalid with -1 concurrently just
+ * before calling this function being a shutdown state of the thread.
+ */
+ if (fd < 0) {
+ ret = -EBADF;
+ goto error;
+ }
do {
ret = write(fd, &sock, sizeof(sock));
do {
ret = write(fd, &sock, sizeof(sock));
@@
-1650,7
+1657,12
@@
static void *thread_dispatch_ust_registration(void *data)
if (ret < 0) {
rcu_read_unlock();
session_unlock_list();
if (ret < 0) {
rcu_read_unlock();
session_unlock_list();
- /* No notify thread, stop the UST tracing. */
+ /*
+ * No notify thread, stop the UST tracing. However, this is
+ * not an internal error of the this thread thus setting
+ * the health error code to a normal exit.
+ */
+ err = 0;
goto error;
}
goto error;
}
@@
-1675,7
+1687,12
@@
static void *thread_dispatch_ust_registration(void *data)
if (ret < 0) {
rcu_read_unlock();
session_unlock_list();
if (ret < 0) {
rcu_read_unlock();
session_unlock_list();
- /* No apps. thread, stop the UST tracing. */
+ /*
+ * No apps. thread, stop the UST tracing. However, this is
+ * not an internal error of the this thread thus setting
+ * the health error code to a normal exit.
+ */
+ err = 0;
goto error;
}
goto error;
}
@@
-4653,6
+4670,14
@@
int main(int argc, char **argv)
/* Initialize communication library */
lttcomm_init();
/* Initialize communication library */
lttcomm_init();
+ /* This is to get the TCP timeout value. */
+ lttcomm_inet_init();
+
+ /*
+ * Initialize the health check subsystem. This call should set the
+ * appropriate time values.
+ */
+ health_init();
/* Create thread to manage the client socket */
ret = pthread_create(&ht_cleanup_thread, NULL,
/* Create thread to manage the client socket */
ret = pthread_create(&ht_cleanup_thread, NULL,
This page took
0.02733 seconds
and
5
git commands to generate.