Fix: lttng-relayd: forcefully close stream on relayd shutdown
[lttng-tools.git] / src / bin / lttng-relayd / stream.c
index c59bb9416b1c9609ca34884cbc6126daf1295b78..e9c7ad172bc0d2f0e44ff3925ae929bd0b8e1398 100644 (file)
@@ -345,7 +345,15 @@ void stream_put(struct relay_stream *stream)
 
 void try_stream_close(struct relay_stream *stream)
 {
+       bool session_aborted;
+       struct relay_session *session = stream->trace->session;
+
        DBG("Trying to close stream %" PRIu64, stream->stream_handle);
+
+       pthread_mutex_lock(&session->lock);
+       session_aborted = session->aborted;
+       pthread_mutex_unlock(&session->lock);
+
        pthread_mutex_lock(&stream->lock);
        /*
         * Can be called concurently by connection close and reception of last
@@ -387,7 +395,8 @@ void try_stream_close(struct relay_stream *stream)
        }
 
        if (stream->last_net_seq_num != -1ULL &&
-                       ((int64_t) (stream->prev_seq - stream->last_net_seq_num)) < 0) {
+                       ((int64_t) (stream->prev_seq - stream->last_net_seq_num)) < 0
+                       && !session_aborted) {
                /*
                 * Don't close since we still have data pending. This
                 * handles cases where an explicit close command has
This page took 0.023484 seconds and 4 git commands to generate.