orange475 opened a new pull request, #1717:
URL: https://github.com/apache/samza/pull/1717
## Summary
- Fixes a process leak in `PosixCommandBasedStatisticsGetter` where shell
processes spawned to collect system
statistics were not being properly reaped
- Adds `process.waitFor()` call after reading command output to ensure
child processes complete and are removed
from the process table
- Includes comprehensive unit tests to verify the fix and prevent
regression
## Problem
The `PosixCommandBasedStatisticsGetter` class executes shell commands (ps,
grep) to collect memory statistics but
wasn't waiting for these processes to complete. This caused zombie
processes to accumulate over time in
long-running Samza containers, potentially leading to resource exhaustion.
## Solution
- Added `process.waitFor()` after closing the process reader to ensure
proper process cleanup
- Implemented proper interruption handling to maintain thread interrupt
status
- Added unit tests covering normal operation, interruption scenarios, and
multiple executions
## Test Plan
- [x] Added unit tests for process reaping behavior
- [x] Added test for interruption handling during command execution
- [x] Added test for multiple command executions to verify no process
accumulation
- [ ] Run integration tests to verify no regression in statistics
collection
- [ ] Deploy to staging environment and monitor process table for zombie
processes
--
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]