Fix: failure to launch agent thread is not reported
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.c
index bb46093e2586f4f458d60ad2584f7c97d264c0d3..cf30b8ebfbf88feda7cfa84617bf4ff4dae79b25 100644 (file)
@@ -41,6 +41,7 @@
 #include "syscall.h"
 #include "agent.h"
 #include "buffer-registry.h"
+#include "agent-thread.h"
 
 #include "cmd.h"
 
@@ -1344,6 +1345,21 @@ int cmd_enable_channel(struct ltt_session *session,
                attr->attr.switch_timer_interval = 0;
        }
 
+       /* Check for feature support */
+       switch (domain->type) {
+       case LTTNG_DOMAIN_JUL:
+       case LTTNG_DOMAIN_LOG4J:
+       case LTTNG_DOMAIN_PYTHON:
+               if (!agent_tracing_is_enabled()) {
+                       DBG("Attempted to enable a channel in an agent domain but the agent thread is not running");
+                       ret = LTTNG_ERR_AGENT_TRACING_DISABLED;
+                       goto error;
+               }
+               break;
+       default:
+               break;
+       }
+
        switch (domain->type) {
        case LTTNG_DOMAIN_KERNEL:
        {
@@ -2077,6 +2093,12 @@ static int _cmd_enable_event(struct ltt_session *session,
 
                assert(usess);
 
+               if (!agent_tracing_is_enabled()) {
+                       DBG("Attempted to enable an event in an agent domain but the agent thread is not running");
+                       ret = LTTNG_ERR_AGENT_TRACING_DISABLED;
+                       goto error;
+               }
+
                agt = trace_ust_find_agent(usess, domain->type);
                if (!agt) {
                        agt = agent_create(domain->type);
This page took 0.025014 seconds and 4 git commands to generate.