From 8fe8f8bfbe53ad28e7c509f8f5afca1890d4dd1c Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Wed, 5 Jul 2023 11:41:20 +0800
Subject: [PATCH 13/15] [debug] improve debug message for gc containers

Signed-off-by: haozi007 <liuhao27@huawei.com>
---
 src/daemon/modules/container/supervisor/supervisor.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/daemon/modules/container/supervisor/supervisor.c b/src/daemon/modules/container/supervisor/supervisor.c
index 87b623f9..d5997b63 100644
--- a/src/daemon/modules/container/supervisor/supervisor.c
+++ b/src/daemon/modules/container/supervisor/supervisor.c
@@ -194,6 +194,14 @@ retry:
             goto retry;
         }
 
+        // get info of init process in container for debug problem of container
+        proc_t *c_proc = util_get_process_proc_info(pid);
+        if (c_proc != NULL) {
+            ERROR("Container %s into GC with process state: {cmd: %s, state: %c, pid: %d}", name, c_proc->cmd, c_proc->state,
+                  (int)pid);
+            free(c_proc);
+        }
+
         ret = gc_add_container(name, runtime, &data->pid_info);
         if (ret != 0) {
             ERROR("Failed to send container %s to garbage handler", name);
-- 
2.25.1

