[Bug] Process resource leak in system metrics collection (SystemMetrics and LinuxNetMetricManager)

Bug Description

SystemMetrics.updateLinuxSystemMemInfo() and LinuxNetMetricManager.updateNetMetricsByCmd() execute external commands via Runtime.exec() but never call process.waitFor() or process.destroy(). This can lead to:

  1. Zombie processes accumulating over time since the Process is never reaped
  2. File descriptor leaks from unreleased process handles
  3. Potential process hangs if stderr buffer fills up (stdout is consumed but stderr is not)

These methods are called periodically for metrics collection, so the leak compounds over the lifetime of the node.

Affected Files

  • iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/system/SystemMetrics.java:221
  • iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/net/LinuxNetMetricManager.java:222

Fix

  • Add process.waitFor() after reading stdout to reap the child process
  • Add process.destroyForcibly() in a finally block to ensure cleanup on exceptions
  • Handle InterruptedException properly by restoring the interrupt flag