Skip to content
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

Fix dtrace system level scripts #1560

Merged
merged 2 commits into from
Nov 15, 2024
Merged

Fix dtrace system level scripts #1560

merged 2 commits into from
Nov 15, 2024

Conversation

leftwo
Copy link
Contributor

@leftwo leftwo commented Nov 12, 2024

While debugging system level issues on London, we found the dtrace scripts did not handle multiple session IDs correctly and were not showing correct results.

To fix, I did a refactor the scripts get-ds-state and get-lr-state to correctly handle a PID with multiple sessions and improved the printing time for getting a system summary output.

There is now a single dtrace sub-script that gathers all output from all process, then we sort and display a line for
each session in post-processing. This speeds up run time overall.

Sample output:

root@oxz_switch0:~# pilot host exec -c 'hostname && /opt/oxide/crucible_dtrace/get-lr-state.sh' 8-9 
 8  BRM44220011        ok: BRM44220011
oxz_propolis-server_7f810e9c 19793 e1a38744 0 0 0 0 0 0
oxz_propolis-server_68932d85 19836 29d41aea 0 0 0 0 0 0
oxz_propolis-server_68932d85 19836 ccb3ce4c 0 0 0 0 0 0
oxz_propolis-server_501befcb 20559 7ef8a2b6 0 0 0 0 0 0
 9  BRM44220005        ok: BRM44220005
oxz_propolis-server_3354b7e3 20062 8f594433 0 0 0 0 0 0
oxz_propolis-server_54f5c356 21042 ce250057 0 0 0 0 0 0
oxz_propolis-server_0e091218 22706 405c57b7 0 0 0 0 0 0
oxz_propolis-server_057ef9d1 22713 f60d7a47 0 0 0 0 0 0
oxz_propolis-server_52e30c4d 22777 a9649821 0 0 0 0 0 0
oxz_propolis-server_52e30c4d 22777 fe4ae0b9 0 0 0 0 0 0

root@oxz_switch0:~# pilot host exec -c 'hostname && /opt/oxide/crucible_dtrace/get-ds-state.sh' 8-9                                                                   
 8  BRM44220011        ok: BRM44220011
oxz_propolis-server_7f810e9c 19793 e1a38744            active            active            active
oxz_propolis-server_68932d85 19836 29d41aea            active            active            active
oxz_propolis-server_68932d85 19836 ccb3ce4c            active            active            active
oxz_propolis-server_501befcb 20559 7ef8a2b6            active            active            active
 9  BRM44220005        ok: BRM44220005
oxz_propolis-server_3354b7e3 20062 8f594433            active            active            active
oxz_propolis-server_54f5c356 21042 ce250057            active            active            active
oxz_propolis-server_0e091218 22706 405c57b7            active            active            active
oxz_propolis-server_057ef9d1 22713 f60d7a47            active            active            active
oxz_propolis-server_52e30c4d 22777 a9649821            active            active            active
oxz_propolis-server_52e30c4d 22777 fe4ae0b9            active            active            active
root@oxz_switch0:~# 

The dtrace scripts did not handle multiple session IDs.
Refactor the scripts get-ds-state and get-lr-state to correctly
handle a PID with multiple sessions and improved the printing time
for getting a system summary output.
Copy link
Contributor

@faithanalog faithanalog left a comment

Choose a reason for hiding this comment

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

some minor nits but looks fine to me

Comment on lines 10 to 11
while read p; do
# For each line in the file, pull out the PID we are looking at and
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: probably doesnt matter too much here, but should be while read -r p to avoid escape character expansion by the shell

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 1 to 4
/*
* Print a status line for a given PID.
* Exit after 5 seconds.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

question in the header comment: this prints for all PIDs rather than a given PID right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was copy cruft from where I copied the script from. I've fixed the comment to address reality.

Comment on lines 10 to 11
while read p; do
# For each line in the file, pull out the PID we are looking at and
Copy link
Contributor

Choose a reason for hiding this comment

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

same thing about read -r from above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks for the comments.

@leftwo
Copy link
Contributor Author

leftwo commented Nov 15, 2024

The test flake is #1498

@faithanalog
Copy link
Contributor

lets merge it!

@leftwo leftwo merged commit 4dd82c6 into main Nov 15, 2024
16 checks passed
@leftwo leftwo deleted the alan/global-state-from-dtrace branch November 15, 2024 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants