engine icon indicating copy to clipboard operation
engine copied to clipboard

[CP] Workaround iOS text input crash for emoji+Korean text

Open cyanglaz opened this issue 3 years ago β€’ 17 comments

Hot fixing: https://github.com/flutter/flutter/issues/111494 PR: https://github.com/flutter/engine/pull/36295

CP issue: https://github.com/flutter/flutter/issues/112963

Pre-launch Checklist

  • [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • [x] I read the Tree Hygiene wiki page, which explains my responsibilities.
  • [x] I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • [x] I listed at least one issue that this PR fixes in the description above.
  • [x] I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • [x] I updated/added relevant documentation (doc comments with ///).
  • [x] I signed the CLA.
  • [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

cyanglaz avatar Oct 05 '22 18:10 cyanglaz

This pull request was opened from and to a release candidate branch. This should only be done as part of the official Flutter release process. If you are attempting to make a regular contribution to the Flutter project, please close this PR and follow the instructions at Tree Hygiene for detailed instructions on contributing to Flutter.

Reviewers: Use caution before merging pull requests to release branches. Ensure the proper procedure has been followed.

flutter-dashboard[bot] avatar Oct 05 '22 18:10 flutter-dashboard[bot]

Changes LGTM. Are the tests supposed to pass without infra failures?

LongCatIsLooong avatar Oct 05 '22 23:10 LongCatIsLooong

https://fuchsia.googlesource.com/third_party clones failed? @CaseyHillers what's up here?

jmagman avatar Oct 06 '22 02:10 jmagman

I don't understand either. It looks related to https://github.com/flutter/engine/pull/34720, possibly a corrupted bot cache. I'll retry the linux builds.

CaseyHillers avatar Oct 06 '22 17:10 CaseyHillers

nit: Can we update the PR title to be something more desciptive? A common format is [CP] $originalPrTitle

CaseyHillers avatar Oct 06 '22 17:10 CaseyHillers

@cyanglaz Hello. Thanks a lot for the fix and sorry to bother again πŸ™ This issue is getting serious in my country, South Korea. Would there be timeline to merge this and release a hot-fix?

ghost avatar Oct 11 '22 17:10 ghost

src/third_party/libcxx (ERROR)
----------------------------------------
[0:00:02] Started.
_____ src/third_party/libcxx at 7524ef50093a376f334a62a7e5cebf5d238d4c99
running "git cat-file -e 7524ef50093a376f334a62a7e5cebf5d238d4c99^{commit}" in "/b/s/w/ir/cache/git/fuchsia.googlesource.com-third_party-libcxx"
[0:00:02] fatal: Not a valid object name 7524ef50093a376f334a62a7e5cebf5d238d4c99^{commit}
[0:00:02] Commit with hash "7524ef50093a376f334a62a7e5cebf5d238d4c99" not found
[0:00:02] /b/s/w/ir/cache/git/fuchsia.googlesource.com-third_party-libcxx has 0 .pack files, re-bootstrapping if >50 or ==0
[0:00:02] running "git init --bare" in "/b/s/w/ir/cache/git/fuchsia.googlesource.com-third_party-libcxx"
[0:00:02] Reinitialized existing Git repository in /b/s/w/ir/cache/git/fuchsia.googlesource.com-third_party-libcxx/

zanderso avatar Oct 11 '22 18:10 zanderso

@cyanglaz could you push an empty commit to rerun tests.

itsjustkevin avatar Oct 11 '22 20:10 itsjustkevin

@cyanglaz could you push an empty commit to rerun tests.

I re-ran manually 🀞

jmagman avatar Oct 11 '22 21:10 jmagman

Gold has detected about 1 new digest(s) on patchset 2. View them at https://flutter-engine-gold.skia.org/cl/github/36621

skia-gold avatar Oct 11 '22 21:10 skia-gold

/Volumes/Work/s/w/ir/cache/goma/client/gomacc  ../../buildtools/mac-x64/clang/bin/clang++ -MD -MF obj/flutter/shell/platform/darwin/ios/framework/Source/flutter_framework_source.FlutterTextInputPlugin.o.d -DFLUTTER_FRAMEWORK=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DSHELL_ENABLE_SOFTWARE -DSHELL_ENABLE_GL -DSHELL_ENABLE_METAL -DSK_GL -DSK_METAL -DSK_SUPPORT_GPU=1 -DSK_CODEC_DECODES_JPEG -DSK_ENCODE_JPEG -DSK_CODEC_DECODES_PNG -DSK_ENCODE_PNG -DSK_CODEC_DECODES_WEBP -DSK_ENCODE_WEBP -DSK_HAS_WUFFS_LIBRARY -DSK_ENABLE_DUMP_GPU -DSK_DISABLE_AAA -DSK_PARAGRAPH_LIBTXT_SPACES_RESOLUTION -DSK_LEGACY_INNER_JOINS -DSK_LEGACY_IGNORE_DRAW_VERTICES_BLEND_WITH_NO_SHADER -DSK_DISABLE_LEGACY_SHADERCONTEXT -DSK_DISABLE_LOWP_RASTER_PIPELINE -DSK_FORCE_RASTER_PIPELINE_BLITTER -DSK_DISABLE_EFFECT_DESERIALIZATION -DSK_ENABLE_SKSL -DSK_ENABLE_PRECOMPILE -DSK_ASSUME_GL_ES=1 -DSK_ENABLE_API_AVAILABLE -DFLUTTER_RUNTIME_MODE_DEBUG=1 -DFLUTTER_RUNTIME_MODE_PROFILE=2 -DFLUTTER_RUNTIME_MODE_RELEASE=3 -DFLUTTER_RUNTIME_MODE_JIT_RELEASE=4 -DDART_LEGACY_API=\[\[deprecated\]\] -DFLUTTER_RUNTIME_MODE=1 -DFLUTTER_JIT_RUNTIME=1 -DVULKAN_HPP_NO_EXCEPTIONS=1 -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_ENABLE_TRACING=1 -DU_ENABLE_RESOURCE_TRACING=0 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DRAPIDJSON_HAS_STDSTRING -DRAPIDJSON_HAS_CXX11_RANGE_FOR -DRAPIDJSON_HAS_CXX11_RVALUE_REFS -DRAPIDJSON_HAS_CXX11_TYPETRAITS -DRAPIDJSON_HAS_CXX11_NOEXCEPT -DIMPELLER_SUPPORTS_PLATFORM=1 -DIMPELLER_SUPPORTS_RENDERING=1 -DIMPELLER_ENABLE_METAL=1 -DFLUTTER_API_SYMBOL_PREFIX=Embedder -DFLUTTER_NO_EXPORT -I../.. -Igen -I../../third_party/skia -I../../third_party/vulkan_memory_allocator/include -I../../third_party/vulkan-deps/vulkan-headers/src/include -I../../flutter/third_party -I../../flutter -I../../third_party/dart/runtime -I../../third_party/dart/runtime/include -I../../flutter/third_party/txt/src -I../../third_party/harfbuzz/src -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -I../../third_party/rapidjson -I../../third_party/rapidjson/include -Igen/flutter -I../../flutter/shell/platform/darwin/common/framework/Headers -I../../flutter/shell/platform/embedder -isysroot /Volumes/Work/s/w/ir/cache/osx_sdk/XCode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.0.sdk -mios-simulator-version-min=11.0 -fno-strict-aliasing -arch x86_64 -fcolor-diagnostics -Wall -Wextra -Wendif-labels -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-unused-but-set-variable -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-deprecated-copy -Wno-psabi -Wno-unqualified-std-cast-call -Wno-non-c-typedef-for-linkage -Wno-range-loop-construct -Wunguarded-availability -Wno-deprecated-declarations -fvisibility=hidden -stdlib=libc++ -Wstring-conversion -Wnewline-eof -Os -fno-ident -fdata-sections -ffunction-sections -g2  -Werror=overriding-method-mismatch -Werror=undeclared-selector -fvisibility-inlines-hidden -fobjc-call-cxx-cdtors -std=c++17 -fno-rtti -fno-exceptions -nostdinc++ -isystem /Volumes/Work/s/w/ir/cache/osx_sdk/XCode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1  -c ../../flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm -o obj/flutter/shell/platform/darwin/ios/framework/Source/flutter_framework_source.FlutterTextInputPlugin.o
../../flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:76:3: error: unknown type name 'UChar32'
  UChar32 codePoint;
  ^
../../flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:84:57: error: use of undeclared identifier 'UCHAR_EMOJI'
  return gotCodePoint && u_hasBinaryProperty(codePoint, UCHAR_EMOJI);

@cyanglaz this doesn't build, does this also need to cherry-pick #34508? Can you validate the fix on the candidate branch?

jmagman avatar Oct 11 '22 22:10 jmagman

does this also need to cherry-pick #34508?

Or at least the #include "unicode/uchar.h"

jmagman avatar Oct 11 '22 22:10 jmagman

Having some issue with local build and im trying to fix it. Meanwhile, im pushing the #include "unicode/uchar.h" to wait for ci

cyanglaz avatar Oct 11 '22 23:10 cyanglaz

Gold has detected about 4 new digest(s) on patchset 3. View them at https://flutter-engine-gold.skia.org/cl/github/36621

skia-gold avatar Oct 11 '22 23:10 skia-gold

2022-10-11 16:54:34.354889-0700 IosUnitTests[39515:758479] Failed to find assets path for "Frameworks/App.framework/flutter_assets"
2022-10-11 16:54:34.378126-0700 IosUnitTests[39515:760334] [VERBOSE-2:engine.cc(200)] Engine run configuration was invalid.
2022-10-11 16:54:34.379990-0700 IosUnitTests[39515:760334] [VERBOSE-2:shell.cc(604)] Could not launch engine with configuration.
2022-10-11 16:54:34.510220-0700 IosUnitTests[39515:760354] flutter: The Dart VM service is listening on http://127.0.0.1:63572/RlYhrgW4nqo=/
Test Case '-[FlutterTextInputPluginTest testCachedComposedCharacterClearedAtKeyboardInteraction]' failed (0.224 seconds).

I'm not sure what this failure is.

Still trying to build local engine from the release branch, got:

FAILED: clang_arm64/obj/third_party/dart/runtime/vm/compiler/backend/libdart_compiler_precompiler.redundancy_elimination.o 
../../buildtools/mac-x64/clang/bin/clang++ -MD -MF clang_arm64/obj/third_party/dart/runtime/vm/compiler/backend/libdart_compiler_precompiler.redundancy_elimination.o.d -DUSE_OPENSSL=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_LIBCPP_DISABLE_AVAILABILITY=1 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -D_DEBUG -DTARGET_ARCH_X64 -DNDEBUG -DDART_TARGET_OS_MACOS -DDART_TARGET_OS_MACOS_IOS -DDART_PRECOMPILER -I../../third_party/dart/runtime -I../.. -Iclang_arm64/gen -I../../third_party/libcxx/include -I../../third_party/libcxxabi/include -I../../third_party/dart/runtime/include -isysroot /Applications/Xcode_14.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=10.11.0 -fno-strict-aliasing -fstack-protector-all -arch arm64 -fno-aligned-allocation -fcolor-diagnostics -Wall -Wextra -Wendif-labels -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-unused-but-set-variable -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-deprecated-copy -Wno-psabi -Wno-unqualified-std-cast-call -Wno-non-c-typedef-for-linkage -Wno-range-loop-construct -Wunguarded-availability -Wno-deprecated-declarations -fvisibility=hidden -stdlib=libc++ -Wstring-conversion -Wnewline-eof -O0 -g2 -Werror -Wall -Wextra -Wno-unused-parameter -Wno-unused-private-field -Wnon-virtual-dtor -Wvla -Woverloaded-virtual -Wno-comments -g3 -ggdb3 -fno-rtti -fno-exceptions -Wimplicit-fallthrough -fno-strict-vtable-pointers -O3 -fvisibility-inlines-hidden -std=c++17 -fno-rtti -nostdinc++ -nostdinc++ -fvisibility=hidden -fno-exceptions  -c ../../third_party/dart/runtime/vm/compiler/backend/redundancy_elimination.cc -o clang_arm64/obj/third_party/dart/runtime/vm/compiler/backend/libdart_compiler_precompiler.redundancy_elimination.o
In file included from ../../third_party/dart/runtime/vm/compiler/backend/redundancy_elimination.cc:5:
In file included from ../../third_party/dart/runtime/vm/compiler/backend/redundancy_elimination.h:12:
In file included from ../../third_party/dart/runtime/vm/compiler/backend/flow_graph.h:13:
In file included from ../../third_party/dart/runtime/vm/compiler/backend/il.h:17:
In file included from ../../third_party/dart/runtime/vm/code_descriptors.h:12:
In file included from ../../third_party/dart/runtime/vm/runtime_entry.h:15:
In file included from ../../third_party/dart/runtime/vm/native_arguments.h:11:
../../third_party/dart/runtime/vm/simulator.h:12:2: error: Simulator not implemented.
#error Simulator not implemented.
 ^
1 error generated.

Not sure if i need to do something like https://github.com/flutter/flutter/issues/96745

cyanglaz avatar Oct 12 '22 16:10 cyanglaz

Thanks for your hard work πŸ‘ Just FYI: This issue still happens in 16.1 beta 5.

ghost avatar Oct 12 '22 17:10 ghost

I didn't see error: Simulator not implemented error, what command are you running? I tried:

$  ./flutter/tools/gn --no-goma --unoptimized --ios --simulator && ninja -C out/ios_debug_sim_unopt  ios_test_flutter

Not sure why it's missing from the logs, but I reproduced the test failure locally:

FlutterTextInputPluginTest.mm:465 testCachedComposedCharacterClearedAtKeyboardInteraction: ((inputView.text) equal to (finalText)) failed: ("πŸ‘¨β€πŸ‘©β€πŸ‘§β€οΏ½οΏ½μ•„") is not equal to ("οΏ½μ•„")
FlutterTextInputPluginTest.mm:424 testSystemOnlyAddingPartialComposedCharacter: ((inputView.text) equal to (@"πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦μ•„")) failed: ("πŸ‘¨β€πŸ‘©β€πŸ‘§β€οΏ½οΏ½μ•„") is not equal to ("πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦μ•„")
FlutterTextInputPluginTest.mm:435 testSystemOnlyAddingPartialComposedCharacter: ((inputView.text) equal to (@"πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦πŸ˜€μ•„")) failed: ("πŸ‘¨β€πŸ‘©β€πŸ‘§β€οΏ½οΏ½οΏ½οΏ½μ•„") is not equal to ("πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦πŸ˜€μ•„")
/FlutterTextInputPluginTest.mm:446 testSystemOnlyAddingPartialComposedCharacter: ((inputView.text) equal to (@"πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦πŸ˜€μ•„")) failed: ("πŸ‘¨β€πŸ‘©β€πŸ‘§β€οΏ½οΏ½οΏ½οΏ½μ•„") is not equal to ("πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦πŸ˜€μ•„")

When I cherry-picked in https://github.com/flutter/engine/pull/34508 to see if --icu-data-file-path=Frameworks/Flutter.framework/icudtl.dat in the test scheme was needed but those failed as well:

FlutterTextInputPluginTest.mm:500 testCachedComposedCharacterClearedAtKeyboardInteraction: ((inputView.text) equal to (finalText)) failed: ("πŸ‘¨β€πŸ‘©β€πŸ‘§β€οΏ½οΏ½μ•„") is not equal to ("οΏ½μ•„")
FlutterTextInputPluginTest.mm:459 testSystemOnlyAddingPartialComposedCharacter: ((inputView.text) equal to (@"πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦μ•„")) failed: ("πŸ‘¨β€πŸ‘©β€πŸ‘§β€οΏ½οΏ½μ•„") is not equal to ("πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦μ•„")
FlutterTextInputPluginTest.mm:470 testSystemOnlyAddingPartialComposedCharacter: ((inputView.text) equal to (@"πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦πŸ˜€μ•„")) failed: ("πŸ‘¨β€πŸ‘©β€πŸ‘§β€οΏ½οΏ½οΏ½οΏ½μ•„") is not equal to ("πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦πŸ˜€μ•„")
FlutterTextInputPluginTest.mm:481 testSystemOnlyAddingPartialComposedCharacter: ((inputView.text) equal to (@"πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦πŸ˜€μ•„")) failed: ("πŸ‘¨β€πŸ‘©β€πŸ‘§β€οΏ½οΏ½οΏ½οΏ½μ•„") is not equal to ("πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦πŸ˜€μ•„")
FlutterTextInputPluginTest.mm:424 testDeletingBackward: ((inputView.text) equal to (@"αžΉπŸ˜€ text πŸ₯°πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦")) failed: ("αžΉπŸ˜€ text πŸ₯°πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦πŸ‡ΊοΏ½") is not equal to ("αžΉπŸ˜€ text πŸ₯°πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦")
FlutterTextInputPluginTest.mm:426 testDeletingBackward: ((inputView.text) equal to (@"αžΉπŸ˜€ text πŸ₯°")) failed: ("αžΉπŸ˜€ text πŸ₯°πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦πŸ‡Ί") is not equal to ("αžΉπŸ˜€ text πŸ₯°")
FlutterTextInputPluginTest.mm:429 testDeletingBackward: ((inputView.text) equal to (@"αžΉπŸ˜€ text ")) failed: ("αžΉπŸ˜€ text πŸ₯°πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦οΏ½") is not equal to ("αžΉπŸ˜€ text ")
FlutterTextInputPluginTest.mm:437 testDeletingBackward: ((inputView.text) equal to (@"αžΉπŸ˜€")) failed: ("αžΉπŸ˜€ text πŸ₯°πŸ‘¨β€πŸ‘©β€") is not equal to ("αžΉπŸ˜€")
FlutterTextInputPluginTest.mm:439 testDeletingBackward: ((inputView.text) equal to (@"ឹ")) failed: ("αžΉπŸ˜€ text πŸ₯°πŸ‘¨β€πŸ‘©") is not equal to ("ឹ")
FlutterTextInputPluginTest.mm:441 testDeletingBackward: ((inputView.text) equal to (@"")) failed: ("αžΉπŸ˜€ text πŸ₯°πŸ‘¨β€οΏ½") is not equal to ("")

@cyanglaz can you try to step through these and see why these tests are failing?

jmagman avatar Oct 12 '22 23:10 jmagman

@cyanglaz @jmagman I started preparing the release hotfix should we skip this CP?

godofredoc avatar Oct 17 '22 20:10 godofredoc

@cyanglaz and I are actively debugging this right now, can we hold on the release hotfix until this is complete?

jmagman avatar Oct 17 '22 20:10 jmagman

@cyanglaz and I are actively debugging this right now, can we hold on the release hotfix until this is complete?

Sounds good, please let me know when resolved to start the release.

godofredoc avatar Oct 17 '22 20:10 godofredoc

When I cherry-picked in #34508 to see if --icu-data-file-path=Frameworks/Flutter.framework/icudtl.dat in the test scheme was needed but those failed as well:

I think I hadn't built the engine properly on both changes; it does seem to pass if #34508 is cherry-picked before https://github.com/flutter/engine/pull/36295. However I don't have permission to push to your fork, @cyanglaz, can you try that?

jmagman avatar Oct 17 '22 20:10 jmagman

However I don't have permission to push to your fork, @cyanglaz, can you try that?

Created https://github.com/flutter/engine/pull/36807 to try the tests there.

jmagman avatar Oct 17 '22 20:10 jmagman

The tests pass on https://github.com/flutter/engine/pull/36807 which means it should also pass on this one https://ci.chromium.org/p/flutter/builders/try/Mac%20Unopt/19879 since they are now the same.

jmagman avatar Oct 17 '22 20:10 jmagman

Closing in favor of https://github.com/flutter/engine/pull/36807

cyanglaz avatar Oct 17 '22 20:10 cyanglaz