liangyepianzhou commented on code in PR #24272:
URL: https://github.com/apache/pulsar/pull/24272#discussion_r2081484642


##########
build/pulsar_ci_tool.sh:
##########
@@ -579,6 +579,68 @@ ci_create_inttest_coverage_report() {
   echo "::endgroup::"
 }
 
+ci_report_netty_leaks() {
+  if [ -z "$NETTY_LEAK_DUMP_DIR" ]; then
+    echo "NETTY_LEAK_DUMP_DIR isn't set"
+    return 0
+  fi
+  local temp_file=$(mktemp -t netty_leak.XXXX)
+
+  # concat all netty_leak_*.txt files in the dump directory to a temp file
+  if [ -d "$NETTY_LEAK_DUMP_DIR" ]; then
+    find "$NETTY_LEAK_DUMP_DIR" -maxdepth 1 -type f -name "netty_leak_*.txt" 
-exec cat {} \; >> $temp_file
+  fi
+
+  # check if there are any netty_leak_*.txt files in the container logs
+  local container_logs_dir="tests/integration/target/container-logs"
+  if [ -d "$container_logs_dir" ]; then
+    local container_netty_leak_dump_dir="$NETTY_LEAK_DUMP_DIR/container-logs"
+    mkdir -p "$container_netty_leak_dump_dir"
+    while read -r file; do
+      # example file name 
"tests/integration/target/container-logs/ltnizrzm-standalone/var-log-pulsar.tar.gz"
+      # take ltnizrzm-standalone part
+      container_name=$(basename "$(dirname "$file")")
+      target_dir="$container_netty_leak_dump_dir/$container_name"
+      mkdir -p "$target_dir"
+      tar -C "$target_dir" -zxf "$file" --strip-components=1 --wildcards 
--wildcards-match-slash '*/netty_leak_*.txt' >/dev/null 2>&1 || true

Review Comment:
   ```suggestion
         tar -C "$target_dir" -zxf "$file" --strip-components=1 --wildcards 
--wildcards-match-slash '*/netty_leak_*.txt' >/dev/null 2>&1 ||  echo "Error 
extracting $file"
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to