Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Gather demangled stack traces and report the same to console on crashes. #16450

Merged
merged 1 commit into from
Mar 10, 2020

Conversation

chinmaygarde
Copy link
Member

These should only be used on host binaries for more detailed crash reports.
Installing the handler on targets (iOS/Android) may cause use to break existing
crash reporting mechanisms users may have installed themselves in the process.

This should work on Darwin & Linux for now.

Doing something like int* a = nullptr; *a = 12; or abort or tripping an
assertion should print something the following before program termination. We
can tweak the report further if necessary.

[ERROR:flutter/fml/backtrace.cc(110)] Caught signal SIGSEGV during program execution.
Frame 0: 0x10658342c void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)
Frame 1: 0x106555070 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)
Frame 2: 0x106554f81 testing::Test::Run()
Frame 3: 0x106555dc3 testing::TestInfo::Run()
Frame 4: 0x1065570a1 testing::TestSuite::Run()
Frame 5: 0x106562a55 testing::internal::UnitTestImpl::RunAllTests()
Frame 6: 0x10658c22c bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)
Frame 7: 0x1065625c3 bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)
Frame 8: 0x106562445 testing::UnitTest::Run()
Frame 9: 0x105c8dc33 RUN_ALL_TESTS()
Frame 10: 0x105c8dbe6 main
Frame 11: 0x7fff7c2dc3d5 start

Known issue: This routines that generate the stack trace are not signal safe.
But since we only use the same before the process is terminating, this ought to
be fine. I’ll work in a separate patch to convert all the internals to be signal
safe. In the meantime, this will help us better identify the causes of flakes on
our bots.

Fixes flutter/flutter#50244

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

Lgtm

Do we have a big tracking making this signal safe?

@dnfield
Copy link
Contributor

dnfield commented Feb 6, 2020

Have you tested this with flutter test --local-engine and hitting Ctrl + C while a test is running?

@dnfield
Copy link
Contributor

dnfield commented Feb 6, 2020

Just manually tested it, seems fine.

@chinmaygarde
Copy link
Member Author

I tested the following:

  • Ctrl-C from the shell.
  • kill -9 the process.
  • Tripping a gtest assertions (it should NOT print a backtrace).

Do we have a big tracking making this signal safe?

No. I was waiting for approval on this in case folks objected to landing this as is with the caveat.

@dnfield
Copy link
Contributor

dnfield commented Feb 6, 2020

I think it's worth doing even if it doesn't cover all scenarios safely - if it makes things worse we can revert it, but it seems like it wouldn't make things worse for users. And it would significantly help when CI tests fail, or if flutter_tester crashes with a segfault (Which can be very mysterious when it happens).

@chinmaygarde
Copy link
Member Author

xref flutter/flutter#50993

@chinmaygarde chinmaygarde added waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. and removed waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. labels Feb 18, 2020
@chinmaygarde chinmaygarde added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Feb 18, 2020
@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

  • The status or check suite build_and_test_linux_unopt_debug has failed. Please fix the issues identified (or deflake) before re-applying this label.

@fluttergithubbot fluttergithubbot removed the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Feb 19, 2020
@dnfield
Copy link
Contributor

dnfield commented Feb 27, 2020

It seems like this is causing the framework tests to run more slowly and timeout. Not sure why.

@chinmaygarde
Copy link
Member Author

It seems like this is causing the framework tests to run more slowly and timeout. Not sure why.

Unlikely to continue to investigate why.

@chinmaygarde
Copy link
Member Author

As discussed with @dnfield. Enabling only on unit-test targets for now.

These should only be used on host binaries for more detailed crash reports.
Installing the handler on targets (iOS/Android) may cause use to break existing
crash reporting mechanisms users may have installed themselves in the process.

This should work on Darwin & Linux for now.

Doing something like int* a = nullptr; *a = 12; or abort or tripping an
assertion should print something the following before program termination. We
can tweak the report further if necessary.

```
[ERROR:flutter/fml/backtrace.cc(110)] Caught signal SIGSEGV during program execution.
Frame 0: 0x10658342c void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)
Frame 1: 0x106555070 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)
Frame 2: 0x106554f81 testing::Test::Run()
Frame 3: 0x106555dc3 testing::TestInfo::Run()
Frame 4: 0x1065570a1 testing::TestSuite::Run()
Frame 5: 0x106562a55 testing::internal::UnitTestImpl::RunAllTests()
Frame 6: 0x10658c22c bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)
Frame 7: 0x1065625c3 bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)
Frame 8: 0x106562445 testing::UnitTest::Run()
Frame 9: 0x105c8dc33 RUN_ALL_TESTS()
Frame 10: 0x105c8dbe6 main
Frame 11: 0x7fff7c2dc3d5 start
```

Known issue: This routines that generate the stack trace are not signal safe.
But since we only use the same before the process is terminating, this ought to
be fine. I’ll work in a separate patch to convert all the internals to be signal
safe. In the meantime, this will help us better identify the causes of flakes on
our bots.

Fixes flutter/flutter#50244
@chinmaygarde
Copy link
Member Author

Done. PTAL.

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

Still LGTM

@chinmaygarde chinmaygarde added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Mar 10, 2020
@chinmaygarde
Copy link
Member Author

LUCI is red because of an infra issue and the previously failing framework tests are fine. Landing.

@chinmaygarde chinmaygarde merged commit 7c2d975 into flutter:master Mar 10, 2020
@chinmaygarde chinmaygarde deleted the backtrace2 branch March 10, 2020 23:31
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 11, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 11, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 11, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 11, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 11, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 11, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 11, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 11, 2020
jason-simmons added a commit to jason-simmons/flutter that referenced this pull request Mar 11, 2020
2020-03-11 [email protected] Roll src/third_party/dart 4093d08271f6..37530145ff53 (4 commits) (flutter/engine#17090)
2020-03-11 [email protected] Roll src/third_party/skia bf355123ae3b..0340292972b9 (9 commits) (flutter/engine#17089)
2020-03-11 [email protected] Roll fuchsia/sdk/core/mac-amd64 from r_oCI... to 0Z8VF... (flutter/engine#17087)
2020-03-11 [email protected] Roll fuchsia/sdk/core/linux-amd64 from v32mJ... to X3Xm2... (flutter/engine#17086)
2020-03-11 [email protected] Remove the unused method on iOS surface to make the resource context current. (flutter/engine#17084)
2020-03-11 [email protected] Revert "Add support for the Metal backend on all iOS builds. (flutter#17080)" (flutter/engine#17088)
2020-03-11 [email protected] Roll src/third_party/dart ace1d9b9213a..4093d08271f6 (12 commits) (flutter/engine#17082)
2020-03-11 [email protected] Add support for the Metal backend on all iOS builds. (flutter/engine#17080)
2020-03-11 [email protected] Roll src/third_party/skia d3f67dbf9f36..bf355123ae3b (9 commits) (flutter/engine#17079)
2020-03-11 [email protected] Disable Embedder11yTest::A11yTreeIsConsistent to unblock LUCI. (flutter/engine#17081)
2020-03-10 [email protected] Gather demangled stack traces and report the same to console on crashes. (flutter/engine#16450)
2020-03-10 [email protected] Implement asynchronous texture uploads when using the Metal backend on iOS. (flutter/engine#17046)
2020-03-10 [email protected] Roll src/third_party/dart 97674262bc29..ace1d9b9213a (14 commits) (flutter/engine#17078)
2020-03-10 [email protected] Add RTree to flow (flutter/engine#16923)
2020-03-10 [email protected] Roll src/third_party/skia 78dac6dcb222..d3f67dbf9f36 (6 commits) (flutter/engine#17072)
2020-03-10 [email protected] Revert "Fix bounds of image_filter_layer (flutter#16960)" (flutter/engine#17074)
2020-03-10 [email protected] Use the ELF loader to setup AOT symbols in benchmark runner. (flutter/engine#17051)
2020-03-10 [email protected] Roll src/third_party/skia 23899c64e3db..78dac6dcb222 (19 commits) (flutter/engine#17069)
2020-03-10 [email protected] Roll dart to 97674262bc29447dc59d5c93024b18b27d4bcf98. (flutter/engine#17067)
2020-03-10 [email protected] [web] Fixes for Firefox & Safari double underline decoration bugs. (flutter/engine#16994)
2020-03-10 [email protected] Avoid capturing this unsafely in MultiFrameCodec (flutter/engine#16824)
2020-03-10 [email protected] Revert "Revert "fix shadows and mask filter blurs (flutter#16963)" (flutter#17008)" (flutter/engine#17040)
2020-03-10 [email protected] Add support for firefox mac installer. Update web_ui pubspec for http.wq (flutter/engine#17044)
2020-03-09 [email protected] fix "TREE INCONSISTENT" noise in compositing_test.dart (flutter/engine#16995)
2020-03-09 [email protected] Add more child lifecycle tests (flutter/engine#16689)
2020-03-09 [email protected] Add libfreetype6-dev to desktop Linux dependencies (flutter/engine#17020)
2020-03-09 [email protected] Disable shell benchmarks (flutter/engine#17038)
2020-03-09 [email protected] Fix bounds of image_filter_layer (flutter/engine#16960)
2020-03-09 [email protected] Record fml and shell benchmarks (flutter/engine#16991)
2020-03-09 [email protected] Roll src/third_party/skia c56950442dd1..23899c64e3db (11 commits) (flutter/engine#17033)
2020-03-09 [email protected] use commit date instead of author date (flutter/engine#17032)
jason-simmons added a commit to flutter/flutter that referenced this pull request Mar 11, 2020
2020-03-11 [email protected] Roll src/third_party/dart 4093d08271f6..37530145ff53 (4 commits) (flutter/engine#17090)
2020-03-11 [email protected] Roll src/third_party/skia bf355123ae3b..0340292972b9 (9 commits) (flutter/engine#17089)
2020-03-11 [email protected] Roll fuchsia/sdk/core/mac-amd64 from r_oCI... to 0Z8VF... (flutter/engine#17087)
2020-03-11 [email protected] Roll fuchsia/sdk/core/linux-amd64 from v32mJ... to X3Xm2... (flutter/engine#17086)
2020-03-11 [email protected] Remove the unused method on iOS surface to make the resource context current. (flutter/engine#17084)
2020-03-11 [email protected] Revert "Add support for the Metal backend on all iOS builds. (#17080)" (flutter/engine#17088)
2020-03-11 [email protected] Roll src/third_party/dart ace1d9b9213a..4093d08271f6 (12 commits) (flutter/engine#17082)
2020-03-11 [email protected] Add support for the Metal backend on all iOS builds. (flutter/engine#17080)
2020-03-11 [email protected] Roll src/third_party/skia d3f67dbf9f36..bf355123ae3b (9 commits) (flutter/engine#17079)
2020-03-11 [email protected] Disable Embedder11yTest::A11yTreeIsConsistent to unblock LUCI. (flutter/engine#17081)
2020-03-10 [email protected] Gather demangled stack traces and report the same to console on crashes. (flutter/engine#16450)
2020-03-10 [email protected] Implement asynchronous texture uploads when using the Metal backend on iOS. (flutter/engine#17046)
2020-03-10 [email protected] Roll src/third_party/dart 97674262bc29..ace1d9b9213a (14 commits) (flutter/engine#17078)
2020-03-10 [email protected] Add RTree to flow (flutter/engine#16923)
2020-03-10 [email protected] Roll src/third_party/skia 78dac6dcb222..d3f67dbf9f36 (6 commits) (flutter/engine#17072)
2020-03-10 [email protected] Revert "Fix bounds of image_filter_layer (#16960)" (flutter/engine#17074)
2020-03-10 [email protected] Use the ELF loader to setup AOT symbols in benchmark runner. (flutter/engine#17051)
2020-03-10 [email protected] Roll src/third_party/skia 23899c64e3db..78dac6dcb222 (19 commits) (flutter/engine#17069)
2020-03-10 [email protected] Roll dart to 97674262bc29447dc59d5c93024b18b27d4bcf98. (flutter/engine#17067)
2020-03-10 [email protected] [web] Fixes for Firefox & Safari double underline decoration bugs. (flutter/engine#16994)
2020-03-10 [email protected] Avoid capturing this unsafely in MultiFrameCodec (flutter/engine#16824)
2020-03-10 [email protected] Revert "Revert "fix shadows and mask filter blurs (#16963)" (#17008)" (flutter/engine#17040)
2020-03-10 [email protected] Add support for firefox mac installer. Update web_ui pubspec for http.wq (flutter/engine#17044)
2020-03-09 [email protected] fix "TREE INCONSISTENT" noise in compositing_test.dart (flutter/engine#16995)
2020-03-09 [email protected] Add more child lifecycle tests (flutter/engine#16689)
2020-03-09 [email protected] Add libfreetype6-dev to desktop Linux dependencies (flutter/engine#17020)
2020-03-09 [email protected] Disable shell benchmarks (flutter/engine#17038)
2020-03-09 [email protected] Fix bounds of image_filter_layer (flutter/engine#16960)
2020-03-09 [email protected] Record fml and shell benchmarks (flutter/engine#16991)
2020-03-09 [email protected] Roll src/third_party/skia c56950442dd1..23899c64e3db (11 commits) (flutter/engine#17033)
2020-03-09 [email protected] use commit date instead of author date (flutter/engine#17032)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Print the backtrace explicitly when assertions are tripped in all unit-test harnesses.
5 participants