summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
dda67f6)
Whenever a write() error occured, both on network or local trace file,
the consumer thread just died considering the error a fatal one.
This commit fixes that by simply deleting the stream, removing it from
the poll set of the thread and freeing it.
Furthermore, on a write() error, a SIGPIPE is usually raised if the FD
is invalid. The consumer is catching this signal but was initiating a
should exit action thus ultimately cleaning all threads. We now still
catch SIGPIPE but don't set the should quit flag so normal cleanup can
be done by the threads.
Signed-off-by: David Goulet <dgoulet@efficios.com>
+ /*
+ * Ignore SIGPIPE because it should not stop the consumer whenever a
+ * SIGPIPE is catched through a FD operation.
+ */
+ if (sig == SIGPIPE) {
+ return;
+ }
+
lttng_consumer_should_exit(ctx);
}
lttng_consumer_should_exit(ctx);
}
if (ret < 0) {
PERROR("write consumer quit");
}
if (ret < 0) {
PERROR("write consumer quit");
}
+
+ DBG("Consumer flag that it should quit");
}
void lttng_consumer_sync_trace_file(struct lttng_consumer_stream *stream,
}
void lttng_consumer_sync_trace_file(struct lttng_consumer_stream *stream,
+ DBG("Consumer destroying it. Closing everything.");
+
ret = close(ctx->consumer_error_socket);
if (ret) {
PERROR("close");
ret = close(ctx->consumer_error_socket);
if (ret) {
PERROR("close");
len = ctx->on_buffer_ready(stream, ctx);
/* It's ok to have an unavailable sub-buffer */
if (len < 0 && len != -EAGAIN && len != -ENODATA) {
len = ctx->on_buffer_ready(stream, ctx);
/* It's ok to have an unavailable sub-buffer */
if (len < 0 && len != -EAGAIN && len != -ENODATA) {
- rcu_read_unlock();
- goto end;
+ /* Clean up stream from consumer and free it. */
+ lttng_poll_del(&events, stream->wait_fd);
+ consumer_del_metadata_stream(stream, metadata_ht);
} else if (len > 0) {
stream->data_read = 1;
}
} else if (len > 0) {
stream->data_read = 1;
}
len = ctx->on_buffer_ready(local_stream[i], ctx);
/* it's ok to have an unavailable sub-buffer */
if (len < 0 && len != -EAGAIN && len != -ENODATA) {
len = ctx->on_buffer_ready(local_stream[i], ctx);
/* it's ok to have an unavailable sub-buffer */
if (len < 0 && len != -EAGAIN && len != -ENODATA) {
+ /* Clean the stream and free it. */
+ consumer_del_stream(local_stream[i], data_ht);
} else if (len > 0) {
local_stream[i]->data_read = 1;
}
} else if (len > 0) {
local_stream[i]->data_read = 1;
}
len = ctx->on_buffer_ready(local_stream[i], ctx);
/* it's ok to have an unavailable sub-buffer */
if (len < 0 && len != -EAGAIN && len != -ENODATA) {
len = ctx->on_buffer_ready(local_stream[i], ctx);
/* it's ok to have an unavailable sub-buffer */
if (len < 0 && len != -EAGAIN && len != -ENODATA) {
+ /* Clean the stream and free it. */
+ consumer_del_stream(local_stream[i], data_ht);
} else if (len > 0) {
local_stream[i]->data_read = 1;
}
} else if (len > 0) {
local_stream[i]->data_read = 1;
}