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 build_id logic for fuchsia symbols #16397

Merged
merged 10 commits into from
Feb 5, 2020
Merged

Conversation

dnfield
Copy link
Contributor

@dnfield dnfield commented Feb 5, 2020

llvm-readelf --hex-dump=.note.gnu.build-id gives output like this:

Hex dump of section '.note.gnu.build-id':
0x000002e8 04000000 14000000 03000000 474e5500 ............GNU.
0x000002f8 e2911dbc 6820ea37 22d5bafa 9fee3db3 ....h .7".....=.
0x00000308 d6fcf810                            ....

We're then taking the last line (into a var named second_line!), including the string representation of the hex bytes, which sometimes results in getting a /. This causes failures like https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket.appspot.com/8889296931334102496/+/steps/build_fuchsia_debug_x64_flutter_shell_platform_fuchsia:fuchsia_fuchsia_tests/0/stdout, because you can't have a file with a / in it on a POSIX file system.

This also isn't actually getting the right build id. This patch uses llvm-readelf -n to get the nice buildID we want:

Displaying notes found at file offset 0x000002e8 with length 0x00000024:
  Owner                Data size 	Description
  GNU                  0x00000014	NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: 0a1ca5114c5c5548ee483781585f5e89228f9e66

I then still tried to keep the old logic, but I'm not 100% sure about the directory structure. This will result in a file like:

out/fuchsia_debug_x64/flutter-debug-symbols-debug-fuchsia-x64/e2/911dbc6820ea3722d5bafa9fee3db3d6fcf810.debug, which I'm assuming is correct for a buildID of e2911dbc6820ea3722d5bafa9fee3db3d6fcf810.

I've also changed the retry logic so that it is just ok if the directory exists, and only fails if we failed to create the directory. It fails sometimes because another process is also creating the directoyr we're trying to create and just got there first. This avoids the loop and the extraneous error messages during build.

@dnfield
Copy link
Contributor Author

dnfield commented Feb 5, 2020

Assuming this is approved, thsi should be landed on red - the current cause of redness in the tree is the failure in the existing logic.

Copy link
Contributor

@iskakaushik iskakaushik left a comment

Choose a reason for hiding this comment

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

LGTM

second_line = file_out.splitlines()[-1].split()
build_id = second_line[1] + second_line[2]
file_out = subprocess.check_output([read_elf, '-n', exec_path])
build_id = file_out.splitlines()[-1].split()[-1]
Copy link
Member

Choose a reason for hiding this comment

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

Can we look for a hex string instead? This depends on the output of readelf being stable.

Copy link
Member

Choose a reason for hiding this comment

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

I'd also vote for more error message here. Something like, "Tried to find a hex string of the SHA1 hash of the text sections in the ELF file as the build_id. But failed because of...".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that would be better.

Is it safe to assume it will be a SHA-1 hex string? That way we can assert on the length and content.

Copy link
Member

Choose a reason for hiding this comment

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

If we change it, I'd rather it fail right away. Also, please log that we are explicitly looking for a SHA1 hex string in the build-id when you assert. Asserting here would definitely be better than failing because we failed to create some directory later. This error manifested way to far away from where the issue was occurred.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated - PTAL

@chinmaygarde
Copy link
Member

Can we land this? This should unblock LUCI.

@dnfield
Copy link
Contributor Author

dnfield commented Feb 5, 2020

I'm still seeing crashes, trying to make sure it's not anything in this...

@dnfield
Copy link
Contributor Author

dnfield commented Feb 5, 2020

Ah. I'm going to land this.

There's a bug in the recipes for try jobs.

@dnfield dnfield merged commit c107969 into flutter:master Feb 5, 2020
@dnfield dnfield deleted the fix_buildid branch February 5, 2020 20:59
@dnfield
Copy link
Contributor Author

dnfield commented Feb 5, 2020

Filed flutter/flutter#50211 to fix the other issue seen in this PR.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 6, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 6, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 6, 2020
jason-simmons pushed a commit to flutter/flutter that referenced this pull request Feb 6, 2020
* 9347c93 Roll src/third_party/dart c8ed304e979a..3414b5167554 (52 commits) (flutter/engine#16362)

* 16cd6f0 Roll fuchsia/sdk/core/mac-amd64 from 6h3IH... to Ke00Y... (flutter/engine#16360)

* 8c6cc65 Fix runtime type errors when running with canvaskit (flutter/engine#16312)

* 677b563 Refactor of Vulkan GPUSurface code (flutter/engine#16224)

* 7ca44d3 Kill the test harness if any test exceeds a timeout. (flutter/engine#16349)

* 7f6149c Revert "Remove use of the deprecated AccessibilityNodeInfo boundsInPa… (flutter/engine#16355)

* 488f489 Roll fuchsia/sdk/core/linux-amd64 from Tszo5... to VJv0H... (flutter/engine#16363)

* 7c9b11a Roll src/third_party/skia 71ce449d2814..2aee7d24da8f (5 commits) (flutter/engine#16364)

* 7e1d144 Expose enable-service-port-fallback switch (flutter/engine#16366)

* 4cda916 Expose the dart kernel snapshot target and copied assets as a public dependency (flutter/engine#16266)

* 73c5130 Roll src/third_party/dart 3414b5167554..68e904e444dc (17 commits) (flutter/engine#16367)

* 1cd8f3b Fix and consolidate wstring conversion utils (flutter/engine#16342)

* b98a39e Add docs (flutter/engine#16368)

* e3e6de2 Roll buildroot to c44791c89d2b51bfce864ab2cf5228d41ece1fcc (flutter/engine#16371)

* e24ec59 Fuchsia a11y actions (flutter/engine#16321)

* d8400c9 Roll src/third_party/skia 2aee7d24da8f..14d64afaa8a3 (10 commits) (flutter/engine#16374)

* eeabd4d Roll src/third_party/dart 68e904e444dc..48808f7dce81 (17 commits) (flutter/engine#16377)

* 22b994c Roll fuchsia/sdk/core/mac-amd64 from Ke00Y... to ubThi... (flutter/engine#16378)

* 0471f44 Roll src/third_party/skia 14d64afaa8a3..6c9b1fd6663e (7 commits) (flutter/engine#16380)

* 852d824 Roll src/third_party/dart 48808f7dce81..34893faa6079 (7 commits) (flutter/engine#16381)

* 4aa2083 Roll src/third_party/skia 6c9b1fd6663e..bc3307c395e2 (1 commits) (flutter/engine#16383)

* 036c370 Copied Apple's semantics for switches, made checkboxes the same. (flutter/engine#16211)

* c107969 fix build_id logic for fuchsia symbols (flutter/engine#16397)

* 11b7704 [fuchsia] Migrate flutter runner to use Present2 (flutter/engine#14162)

* 646ec35 Update license output (flutter/engine#16379)

* 925c60b Fix Windows embedding issues caught by clang (flutter/engine#16369)

* 31bf3e1 Roll src/third_party/dart 34893faa6079..b3396cbdcae1 (36 commits) (flutter/engine#16422)

* 8f89bac [web] Fixes incorrect transform when context save and transforms are deferred. (flutter/engine#16412)

* f34bc65 use percent for golden diff rates; tighten the values (flutter/engine#16430)
NoamDev pushed a commit to NoamDev/engine that referenced this pull request Feb 27, 2020
NoamDev added a commit to NoamDev/engine that referenced this pull request Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants