-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Fix process and file descriptor leaks in Salt Master #69227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
42a0aba
Fix process and file descriptor leaks in Salt Master
33ad623
Fix resource leaks in master, minion, and API
4691af9
Add nightly stress test workflow and monitoring tools
23bb5bc
Fix lint errors in monitoring scripts
4017532
Capture Prometheus metrics as build artifacts
0c3f53d
Remove __del__ methods from leak fixes
6f1fe5b
Fix file descriptor leak in ZeroMQSocketMonitor
633ea83
Fix CI failures from diff: Login.api, MasterMinion ctx, monitoring sc…
dwoz 0ac93d9
Remove MWorker handler recycling in _handle_payload
dwoz 5c17988
Restore worker_resource_backcount and fix test_publisher_mem flakiness
dwoz 90dc6a3
Fix missing explicit teardown for LazyLoaders and bound methods
28d34f9
Make FakeRunner test doubles context managers
dwoz d4e2e07
Fix multiple memory leaks across master, minion and IPC transport
dwoz 1c4e53a
Stress-test infrastructure: ipc_write_buffer caps, debug-symbol Pytho…
dwoz 7c5b94b
Merge remote-tracking branch 'origin/3006.x' into 3006leak
dwoz 63e21ea
Fix test_master MaintenanceTestCase for _cached_mminion attribute
dwoz 03c7d71
Restore IPCMessageSubscriber._read callback loop
dwoz baf789a
Fix two regressions from the leak-fix commit
dwoz 569db36
Fix MWorkerQueue ZMQ leak under sustained CLI churn
dwoz 87b7a5b
Skip ZMQ identity scoping on minion daemon REQ sockets
dwoz f9f272c
Restrict stable ZMQ identity to salt CLI tools only
dwoz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| name: Nightly Stress Test | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 2 * * *' # 2 AM UTC | ||
| workflow_dispatch: | ||
| inputs: | ||
| duration: | ||
| description: 'Duration of the stress test (e.g., 30m, 1h)' | ||
| required: true | ||
| default: '30m' | ||
|
|
||
| jobs: | ||
| stress-test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Cache Docker layers | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: /tmp/.buildx-cache | ||
| key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-buildx- | ||
|
|
||
| - name: Build and Start Environment | ||
| run: | | ||
| cd tests/monitoring | ||
| docker compose build | ||
| docker compose up -d | ||
| sleep 30 # Wait for initialization | ||
|
|
||
| - name: Verify Connections | ||
| run: | | ||
| docker exec salt-master salt '*' test.ping | ||
|
|
||
| - name: Run Aggressive Stress Test | ||
| run: | | ||
| cd tests/monitoring | ||
| chmod +x stress_test.sh stress_api.sh | ||
| # Run in background and wait for defined duration | ||
| ./stress_test.sh & | ||
| STRESS_PID=$! | ||
|
|
||
| # Default to 30m if not workflow_dispatch | ||
| DURATION="${{ github.event.inputs.duration || '30m' }}" | ||
| echo "Running stress test for $DURATION..." | ||
|
|
||
| # Use sleep with suffix support (m, h) | ||
| sleep $DURATION | ||
|
|
||
| echo "Stopping stress test..." | ||
| pkill -P $STRESS_PID || true | ||
| kill $STRESS_PID || true | ||
|
|
||
| - name: Analyze Results | ||
| run: | | ||
| cd tests/monitoring | ||
| # Give Prometheus a moment to finish scraping the final points | ||
| sleep 30 | ||
| python3 analyze_stats.py | ||
|
|
||
| - name: Snapshot Metrics | ||
| if: always() | ||
| run: | | ||
| # Stop containers to ensure data is flushed to disk | ||
| cd tests/monitoring | ||
| docker compose stop prometheus | ||
| sudo tar -czf ../../prometheus-data.tar.gz ./prometheus_data | ||
|
|
||
| - name: Collect Logs on Failure | ||
| if: failure() | ||
| run: | | ||
| mkdir -p artifacts | ||
| docker logs salt-master > artifacts/salt-master.log | ||
| docker logs salt-minion-1 > artifacts/salt-minion-1.log | ||
| cp monitoring/event_log.txt artifacts/ || true | ||
|
|
||
| - name: Upload Artifacts | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: stress-test-results | ||
| path: | | ||
| artifacts/ | ||
| prometheus-data.tar.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --python-platform=macos --python-version=3.10 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.10/darwin-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --universal --python-version=3.10 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.10/freebsd-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --python-platform=linux --python-version=3.10 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.10/linux-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --python-platform=windows --python-version=3.10 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.10/windows-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --python-platform=macos --python-version=3.11 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.11/darwin-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --universal --python-version=3.11 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.11/freebsd-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --python-platform=linux --python-version=3.11 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.11/linux-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --python-platform=windows --python-version=3.11 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.11/windows-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --python-platform=macos --python-version=3.12 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.12/darwin-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --universal --python-version=3.12 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.12/freebsd-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --python-platform=linux --python-version=3.12 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.12/linux-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --python-platform=windows --python-version=3.12 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.12/windows-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --python-platform=macos --python-version=3.13 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.13/darwin-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --universal --python-version=3.13 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.13/freebsd-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --python-platform=linux --python-version=3.13 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.13/linux-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --python-platform=windows --python-version=3.13 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.13/windows-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --python-platform=macos --python-version=3.9 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.9/darwin-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --universal --python-version=3.9 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.9/freebsd-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --python-platform=linux --python-version=3.9 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.9/linux-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile requirements/static/ci/crypto.in --python-platform=windows --python-version=3.9 --constraint requirements/constraints.txt --no-emit-index-url -o=requirements/static/ci/py3.9/windows-crypto.in | ||
| m2crypto==0.48.0 | ||
| # via -r requirements/static/ci/crypto.in | ||
| packaging==26.2 | ||
| # via m2crypto | ||
| pycryptodome==3.23.0 | ||
| # via -r requirements/static/ci/crypto.in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use getattr instead of hasattr to make this slightly less verbose: