PDGGK opened a new issue, #17211:
URL: https://github.com/apache/iotdb/issues/17211

   ## 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


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to