Repository navigation
Commit 9584c67
authored
[CP-stable][flutter_tools] Safely handle non-JSON messages in test stream parsers (#192419)
This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request)
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.
### Issue Link:
#191898
### Impact Description:
Top crash in Flutter 3.47.1 accounting for 245 crashes (11.7% share of top crashes). When a test runner process or browser socket dumps unformatted non-JSON error output (such as dynamic library loading errors or missing snapshot warnings) directly onto the test communication stream or WebSocket, `_ChunkedJsonParser` throws an unhandled `FormatException: Unexpected character (at character 1)`, terminating the `flutter test` CLI process.
### Changelog Description:
[flutter/191898] When remote test processes emit plain-text error output on all platforms, prevent flutter_tools from crashing with an unhandled FormatException.
### Workaround:
None. Any test execution where a child runner or socket prints plain text instead of JSON fatal crashes the test runner CLI.
### Risk:
### Test Coverage:
### Validation Steps:
Run `flutter test test/general.shard/flutter_platform_test.dart` and `flutter test test/commands.shard/hermetic/flutter_web_platform_test.dart`.
Specifically, `pipeHarnessToRemote safely ignores non-JSON string and logs warning` validates that plain text received over the stream logs a warning/trace without crashing the process, and subsequent valid JSON packets are processed normally.1 parent 5743177 commit 9584c67
3 files changed
Lines changed: 81 additions & 19 deletions
File tree
- packages/flutter_tools
- lib/src/test
- test/general.shard
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
721 | 721 | | |
722 | 722 | | |
723 | 723 | | |
724 | | - | |
| 724 | + | |
725 | 725 | | |
726 | 726 | | |
727 | 727 | | |
| |||
889 | 889 | | |
890 | 890 | | |
891 | 891 | | |
892 | | - | |
| 892 | + | |
| 893 | + | |
893 | 894 | | |
894 | | - | |
| 895 | + | |
895 | 896 | | |
896 | 897 | | |
897 | 898 | | |
| |||
902 | 903 | | |
903 | 904 | | |
904 | 905 | | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
910 | 919 | | |
911 | 920 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
699 | 699 | | |
700 | 700 | | |
701 | 701 | | |
| 702 | + | |
702 | 703 | | |
703 | 704 | | |
704 | 705 | | |
| |||
760 | 761 | | |
761 | 762 | | |
762 | 763 | | |
763 | | - | |
| 764 | + | |
764 | 765 | | |
765 | 766 | | |
766 | 767 | | |
| |||
777 | 778 | | |
778 | 779 | | |
779 | 780 | | |
780 | | - | |
781 | | - | |
782 | | - | |
783 | | - | |
784 | | - | |
785 | | - | |
786 | | - | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
787 | 796 | | |
788 | | - | |
789 | | - | |
| 797 | + | |
| 798 | + | |
790 | 799 | | |
791 | 800 | | |
792 | 801 | | |
| |||
797 | 806 | | |
798 | 807 | | |
799 | 808 | | |
| 809 | + | |
800 | 810 | | |
801 | 811 | | |
802 | 812 | | |
| |||
856 | 866 | | |
857 | 867 | | |
858 | 868 | | |
| 869 | + | |
859 | 870 | | |
860 | 871 | | |
861 | 872 | | |
| |||
888 | 899 | | |
889 | 900 | | |
890 | 901 | | |
891 | | - | |
| 902 | + | |
892 | 903 | | |
893 | 904 | | |
894 | 905 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
249 | 291 | | |
250 | 292 | | |
251 | 293 | | |
| |||
0 commit comments