Skip to content

Conversation

@abh1sar
Copy link
Collaborator

@abh1sar abh1sar commented Jan 21, 2026

Description

This PR fixes a potential process and stream leaks during piped command execution by ensuring proper cleanup of all processes created during piped command execution by tracking the full process pipeline and cleaning it up in a finally block. This prevents intermediate processes from being left running on timeouts or failures, reducing the risk of resource and file-descriptor leaks.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.24%. Comparing base (8db7cab) to head (a4926a1).

Files with missing lines Patch % Lines
...s/src/main/java/com/cloud/utils/script/Script.java 82.35% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #12478   +/-   ##
=========================================
  Coverage     16.24%   16.24%           
- Complexity    13393    13394    +1     
=========================================
  Files          5657     5657           
  Lines        499107   499123   +16     
  Branches      60574    60577    +3     
=========================================
+ Hits          81069    81080   +11     
- Misses       409001   409004    +3     
- Partials       9037     9039    +2     
Flag Coverage Δ
uitests 4.03% <ø> (ø)
unittests 17.10% <82.35%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@abh1sar abh1sar marked this pull request as ready for review January 21, 2026 04:11
@abh1sar
Copy link
Collaborator Author

abh1sar commented Jan 21, 2026

@blueorangutan package

@abh1sar abh1sar added this to the 4.20.3 milestone Jan 21, 2026
@blueorangutan
Copy link

@abh1sar a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16455

@abh1sar abh1sar requested a review from nvazquez January 21, 2026 06:57
Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@DaanHoogland
Copy link
Contributor

can you add some testing advice to the description, @abh1sar ?

@abh1sar
Copy link
Collaborator Author

abh1sar commented Jan 21, 2026

can you add some testing advice to the description, @abh1sar ?

This is more of a defensive fix that follows the existing pattern in the file and kills any processes that were spawned by the piped command after timeout. I couldn't reproduce or test process leaks deterministically.

I think smokes and some regression testing should do.

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@abh1sar
Copy link
Collaborator Author

abh1sar commented Jan 21, 2026

@blueorangutan package

@blueorangutan
Copy link

@abh1sar a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Copy link
Contributor

@nvazquez nvazquez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM - thanks @abh1sar

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16470

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants