You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "PDGGK (via GitHub)" <gi...@apache.org> on 2026/02/22 17:52:08 UTC

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

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: reviews-unsubscribe@iotdb.apache.org.apache.org

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


Re: [I] [Bug] Process resource leak in system metrics collection (SystemMetrics and LinuxNetMetricManager) [iotdb]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #17211:
URL: https://github.com/apache/iotdb/issues/17211#issuecomment-3941440951

   Hi, this is your first issue in IoTDB project. Thanks for your report. Welcome to join the community!


-- 
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: reviews-unsubscribe@iotdb.apache.org

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


Re: [I] [Bug] Process resource leak in system metrics collection (SystemMetrics and LinuxNetMetricManager) [iotdb]

Posted by "CRZbulabula (via GitHub)" <gi...@apache.org>.
CRZbulabula closed issue #17211: [Bug] Process resource leak in system metrics collection (SystemMetrics and LinuxNetMetricManager)
URL: https://github.com/apache/iotdb/issues/17211


-- 
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: reviews-unsubscribe@iotdb.apache.org

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