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(cli/bench): skip strace table border #16310

Merged
merged 2 commits into from
Oct 16, 2022

Conversation

marcosc90
Copy link
Contributor

@marcosc90 marcosc90 commented Oct 16, 2022

Fixes #16302

It crashes due to the table border output from strace,

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ---------------- # this is skipped correctly
 61.27    6.012053         678      8860       637 futex
   0.00    0.000000           0         4           geteuid
------ ----------- ----------- --------- --------- ----------------  # this causes the crash
100.00   11.732230                 25552      1205 total

It's flaky because that line is not always skipped from the output, for some reason that I've yet to find out.

deno/test_util/src/lib.rs

Lines 2201 to 2212 in 323ddc8

let mut lines = output
.lines()
.filter(|line| !line.is_empty() && !line.contains("detached ..."));
let count = lines.clone().count();
if count < 4 {
return summary;
}
let total_line = lines.next_back().unwrap();
lines.next_back(); // Drop separator
let data_lines = lines.skip(2);

test_util/src/lib.rs Outdated Show resolved Hide resolved
@marcosc90
Copy link
Contributor Author

Found the root cause, the table separator is not skipped correctly because the output begins with:

87381 ????( <unfinished ...>
87358 ????( <detached ...>
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------

And we're only skipping "detached" line.

!line.is_empty()
&& !line.contains("detached ...")
&& !line.contains("unfinished ...")
&& !line.contains("????")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line is future proofing, since I do not know all possible strace states that are sometimes present at the beginning of the file, but it seems that all of them contains ????

87381 ????( <unfinished ...>
87358 ????( <detached ...>

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for digging into this @marcosc90

@bartlomieju bartlomieju merged commit 9fe508d into denoland:main Oct 16, 2022
@marcosc90 marcosc90 deleted the fix-parse-strace-output branch October 16, 2022 19:39
bartlomieju pushed a commit that referenced this pull request Oct 17, 2022
It crashes due to the table border output from `strace`,

```
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ---------------- # this is skipped correctly
 61.27    6.012053         678      8860       637 futex
   0.00    0.000000           0         4           geteuid
------ ----------- ----------- --------- --------- ----------------  # this causes the crash
100.00   11.732230                 25552      1205 total

```

It's flaky because that line is not always skipped from the output, for
some reason that I've yet to find out.
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.

CI pipeliene for benchmarks crashes when parsing float
2 participants