-
Notifications
You must be signed in to change notification settings - Fork 141
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
unable to collapse generated profile data: Custom { kind: InvalidData, error: StringError("stream did not contain valid UTF-8") } #32
Comments
Happening on mine too for all runs
|
I hit this too. I'm not sure yet what's causing it, but here are some notes: First, I commented out the line that deletes the raw dtrace dump: @@ -163,11 +166,11 @@ mod arch {
output file cargo-flamegraph.stacks",
);
- std::fs::remove_file("cargo-flamegraph.stacks")
- .expect(
- "unable to remove cargo-flamegraph.stacks \
- temporary file",
- );
+ //std::fs::remove_file("cargo-flamegraph.stacks")
+ // .expect(
+ // "unable to remove cargo-flamegraph.stacks \
+ // temporary file",
+ // );
buf
} I tried specifying the encoding to be utf-8 in case that wasn't the default, but still get the same error sometimes. Looking at the file, it mostly looks ok. How to track down the offending non-utf8 chars? Maybe roundtrip through iconv?
Ok - so maybe something is wrong on line 154433, let's take a look:
The offending line looks something like this (though obviously I can't paste invalid unicode into GH's text area (here it is zipped if you're feeling brave: offending_line.stacks.zip):
Hmm.. so maybe it's some exotic encoding - what does chardetect think it might be?
Ok, maybe it's ISO-8859-1? Let's try to convert:
Note in particular, the last entry: "objc::D»" I've gone through this exercise a few times, and do not always get the same guessed encoding, which makes me think this might be some kind of corruption rather than dtrace wittingly using an obscure encoding, but who knows 🤷 |
I'm also on a mac btw (10.15) $ dtrace -V Is anyone hitting this not on a mac? |
Intermittently, invalid utf-8 is found in cargo-flamegraph.stacks, which causes parsing to blow up with the error: > unable to collapse generated profile data: Custom { kind: InvalidData, error: StringError("stream did not contain valid UTF-8") } This commit doesn't fix the underlying problem, but simply works around it by lossily re-encoding to valid utf8. Anecdotally it seems to be macos symbol names at the end of the line that contain the invalid utf-8 - I don't know if this is due to some error in dtrace or if somehow the symbols actually contain non utf-8 encodings. Note I did try explicitly specifying utf8 output, by adding to the dtrace command invocation: command.arg("-x"); command.arg("encoding=utf8"); But I ran into the same error seemingly just as often.
I have a workaround at #101, it would be interesting if anyone who frequently experiences this error could give it a whirl. |
Assuming it's a bug that dtrace ever outputs invalid utf-8, I filed a radar (rdar://8800290) and duped to open radar here: https://openradar.appspot.com/radar?id=5013532726788096 |
btw I am just seeing this now but I added support for non-utf8 in inferno here: jonhoo/inferno#196 It's not released nor version bumped in this repo, but if you need something to work with without having to fork yourself, can use this for the time being:
I made the change in inferno so it can be used other than just in this repo |
101: Workaround #32 - fails parsing invalid utf8 dtrace output (macos only?) r=spacejam a=michaelkirk Intermittently, invalid utf-8 is found in cargo-flamegraph.stacks, which causes parsing to blow up with the error: > unable to collapse generated profile data: Custom { kind: InvalidData, error: StringError("stream did not contain valid UTF-8") } This commit doesn't fix the underlying problem, but simply works around it by lossily re-encoding to valid utf8. Anecdotally it seems to be macos symbol names at the end of the line that contain the invalid utf-8 - I don't know if this is due to some error in dtrace or if somehow the symbols actually contain non utf-8 encodings. Note I did try explicitly specifying utf8 output, by adding to the dtrace command invocation: command.arg("-x"); command.arg("encoding=utf8"); But I ran into the same error seemingly just as often. --- This is admittedly a hack, so I understand if you don't want to merge it, but it might be helpful for folks like me experiencing #32. Anecdotally this commit seems to completely fix things for me. Without it I get the above error about 50% of the time — making it quite frustrating to use this otherwise very nice tool. 🙂 The caveat is that presumably the invalid symbol names will not be correctly labeled/classified, but in practice this hasn't bitten me yet, since it seems to be a relatively small number of affected lines. Co-authored-by: Michael Kirk <michael.code@endoftheworl.de>
Randomly panic on my mac
The text was updated successfully, but these errors were encountered: