-
Notifications
You must be signed in to change notification settings - Fork 171
cobalt/tools: Robustify analysis pipeline against invalid timestamps #7862
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
johnxwork
merged 2 commits into
youtube:main
from
Awallky:add-smaps-capture-scripts-add-more-tests
Nov 4, 2025
Merged
cobalt/tools: Robustify analysis pipeline against invalid timestamps #7862
johnxwork
merged 2 commits into
youtube:main
from
Awallky:add-smaps-capture-scripts-add-more-tests
Nov 4, 2025
+245
−199
Conversation
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
The smaps analysis pipeline was failing due to visualize_smaps_analysis.py receiving invalid timestamp strings from analyze_smaps_logs.py. This occurred when analyze_smaps_logs.py
encountered log files with names that did not conform to the expected timestamp format.
This change addresses the issue by:
- Modifying analyze_smaps_logs.py's extract_timestamp function to return None for filenames that do not contain a valid timestamp, instead of a placeholder string.
- Updating the file filtering logic in analyze_smaps_logs.py to skip any log files for which a valid timestamp cannot be extracted, preventing them from being passed to downstream
visualization.
- Correcting the regular expression in extract_timestamp to accurately match the _processed.txt suffix of the log files generated by read_smaps_batch.py.
- Ensuring the run_analysis_pipeline.py script uses the correct log directory path.
These changes make the smaps analysis pipeline more resilient to malformed log filenames and prevent crashes during visualization, improving its overall usability and correctness.
johnxwork
approved these changes
Nov 4, 2025
cobalt-github-releaser-bot
pushed a commit
that referenced
this pull request
Nov 4, 2025
…7862) The smaps pipeline was too complicated, trying to aggregate some of the memory consumers which were similarly named, such as those with the pattern "mem/shared_memory", among others. There are concerns that this masked or dropped the smaps data, leading to low counts for PSS and RSS. This change speculatively removes this aggregation in case this is a problem. This also fixes some bugs in the visualization script and adds testing to ensure memory leaks are properly accounted for. The smaps analysis pipeline failed on a couple of attempts due to visualize_smaps_analysis.py receiving invalid timestamp strings from analyze_smaps_logs.py. This occurred when analyze_smaps_logs.py encountered log files with names that did not conform to the expected timestamp format. This change addresses the issue by: - Modifying analyze_smaps_logs.py's extract_timestamp function to return None for filenames that do not contain a valid timestamp, instead of a placeholder string. - Updating the file filtering logic in analyze_smaps_logs.py to skip any log files for which a valid timestamp cannot be extracted, preventing them from being passed to downstream visualization. - Correcting the regular expression in extract_timestamp to accurately match the _processed.txt suffix of the log files generated by read_smaps_batch.py. - Ensuring the run_analysis_pipeline.py script uses the correct log directory path. On top of that this adds a test hardening the data integrity for leak detection. The analyze_smaps_logs_test.py includes a test (test_analyze_logs_json_output) that simulates a memory leak. It creates dummy smaps files where a component (<leaking_lib>) shows increasing PSS and RSS values over time. This test then asserts that this time-series memory growth is correctly captured and structured within the JSON output. This ensures that the foundational data required for identifying leaks is accurately processed. Bug: 456178181 (cherry picked from commit 448df2e)
|
Caution Creating the cherry pick PR failed! Check the log at https://github.com/youtube/cobalt/actions/runs/19086314321 for details. |
johnxwork
pushed a commit
that referenced
this pull request
Nov 5, 2025
…st invalid timestamps (#7874) Refer to the original PR: #7862 The smaps pipeline was too complicated, trying to aggregate some of the memory consumers which were similarly named, such as those with the pattern "mem/shared_memory", among others. There are concerns that this masked or dropped the smaps data, leading to low counts for PSS and RSS. This change speculatively removes this aggregation in case this is a problem. This also fixes some bugs in the visualization script and adds testing to ensure memory leaks are properly accounted for. The smaps analysis pipeline failed on a couple of attempts due to visualize_smaps_analysis.py receiving invalid timestamp strings from analyze_smaps_logs.py. This occurred when analyze_smaps_logs.py encountered log files with names that did not conform to the expected timestamp format. This change addresses the issue by: - Modifying analyze_smaps_logs.py's extract_timestamp function to return None for filenames that do not contain a valid timestamp, instead of a placeholder string. - Updating the file filtering logic in analyze_smaps_logs.py to skip any log files for which a valid timestamp cannot be extracted, preventing them from being passed to downstream visualization. - Correcting the regular expression in extract_timestamp to accurately match the _processed.txt suffix of the log files generated by read_smaps_batch.py. - Ensuring the run_analysis_pipeline.py script uses the correct log directory path. On top of that this adds a test hardening the data integrity for leak detection. The analyze_smaps_logs_test.py includes a test (test_analyze_logs_json_output) that simulates a memory leak. It creates dummy smaps files where a component (<leaking_lib>) shows increasing PSS and RSS values over time. This test then asserts that this time-series memory growth is correctly captured and structured within the JSON output. This ensures that the foundational data required for identifying leaks is accurately processed. #vibe-coded Bug: 456178181 Co-authored-by: Adam Walls <avvall@google.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The smaps pipeline was too complicated, trying to aggregate some of the memory consumers which were similarly named, such as those with the pattern "mem/shared_memory", among others. There are concerns that this masked or dropped the smaps data, leading to low counts for PSS and RSS. This change speculatively removes this aggregation in case this is a problem. This also fixes some bugs in the visualization script and adds testing to ensure memory leaks are properly accounted for.
The smaps analysis pipeline failed on a couple of attempts due to visualize_smaps_analysis.py receiving invalid timestamp strings from analyze_smaps_logs.py. This occurred when analyze_smaps_logs.py encountered log files with names that did not conform to the expected timestamp format.
This change addresses the issue by:
On top of that this adds a test hardening the data integrity for leak detection. The analyze_smaps_logs_test.py includes a test (test_analyze_logs_json_output) that simulates a memory leak. It creates dummy smaps files where a component (<leaking_lib>) shows increasing PSS and RSS values over time. This test then asserts that this time-series memory growth is correctly captured and structured within the JSON output. This ensures that the foundational data required for identifying leaks is accurately processed.
#vibe-coded
Bug: 456178181