-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Log FlutterJSONMessageCodec decode errors before asserting #50163
Conversation
} | ||
NSAssert(decoded, @"Invalid JSON message, decoding failed"); | ||
NSAssert(decoded, @"Invalid JSON message, decoding failed: %@", error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to what's already done in encode
NSAssert(encoding, @"Invalid JSON message, encoding failed: %@", error); |
@@ -49,6 +49,7 @@ int main(int argc, char** argv) { | |||
#endif // FML_OS_IOS | |||
|
|||
::testing::InitGoogleTest(&argc, argv); | |||
GTEST_FLAG_SET(death_test_style, "threadsafe"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to add this flag to allow EXPECT_EXIT
.
https://github.com/google/googletest/blob/main/docs/advanced.md#death-test-styles
Otherwise:
[WARNING] ../../third_party/googletest/googletest/src/gtest-death-test.cc:1102:: Death tests use fork(), which is unsafe particularly in a threaded context. For this test, Google Test detected 2 threads. See https://github.com/google/googletest/blob/main/docs/advanced.md#death-tests-and-threads for more explanation and suggested solutions, especially if this is the last message you see before your test times out.
../../flutter/shell/platform/darwin/common/framework/Source/flutter_codecs_unittest.mm:52: Failure
Death test: [codec encode:value]
Result: died but not with expected error.
Expected: contains regular expression "failed to convert to UTF8"
Actual msg:
[ DEATH ] 2024-01-29 18:38:36.256 framework_common_unittests[31544:1799550] *** Assertion failure in -[FlutterJSONMessageCodec encode:], FlutterCodecs.mm:82
[ DEATH ] objc[31544]: +[NSNumber initialize] may have been in progress in another thread when fork() was called.
[ DEATH ] objc[31544]: +[NSNumber initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
…142628) flutter/engine@9ccd81d...20e5361 2024-01-31 skia-flutter-autoroll@skia.org Roll Dart SDK from fbf1d8ebceb4 to 1f136c7b962d (1 revision) (flutter/engine#50203) 2024-01-31 magder@google.com Log FlutterJSONMessageCodec decode errors before asserting (flutter/engine#50163) 2024-01-31 mdebbar@google.com [web] Final nail in FlutterViewEmbedder's coffin (flutter/engine#49769) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC matanl@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Logging JSON decode errors on assertion will help track down bugs.
flutter/flutter#100891 (comment)
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.