Skip to content

Conversation

@jmagman
Copy link
Member

@jmagman jmagman commented Oct 25, 2024

To convince xcdevice observe to redirect to stdout it's being launched in an interactive shell /usr/bin/script -t 0 /dev/null /usr/bin/arch -arm64e xcrun xcdevice observe --usb

// Run in interactive mode (via script) to convince
// xcdevice it has a terminal attached in order to redirect stdout.
return _streamXCDeviceEventCommand(

When the flutter command exits, the interactive script process is terminated, but not its jobs xcdevice observe --usb.

Instead of -9 sigterm killing the interactive script, send it a SIGHUP (signal hangup) during XCDevice.dispose(), which will exit its processes. Add a shutdown hook to ensure dispose is run when the process exits.

Fixes #73859

Pre-launch Checklist

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

@jmagman jmagman self-assigned this Oct 25, 2024
@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems tool Affects the "flutter" command-line tool. See also t: labels. a: desktop Running on desktop labels Oct 25, 2024
@jmagman jmagman force-pushed the xcdevice-observe-shutdown branch 2 times, most recently from 7371131 to 45b7780 Compare October 25, 2024 22:42
@jmagman jmagman added platform-ios iOS applications specifically and removed a: text input Entering text in a text field or keyboard related problems a: desktop Running on desktop labels Oct 25, 2024
@jmagman jmagman force-pushed the xcdevice-observe-shutdown branch from 45b7780 to c0cbb4d Compare October 25, 2024 22:56
@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems a: desktop Running on desktop and removed platform-ios iOS applications specifically labels Oct 25, 2024
@jmagman jmagman marked this pull request as ready for review October 25, 2024 22:58
@jmagman jmagman requested a review from cbracken October 26, 2024 02:51
auto-submit bot pushed a commit that referenced this pull request Oct 28, 2024
#157646 is being labeled by the PR labeler as "text-input" because it edited "con**text**_runner.dart". 
```
##[debug]     "**/*text*" pattern matched packages/flutter_tools/lib/src/context_runner.dart
```
https://github.com/flutter/flutter/actions/runs/11526508378/job/32090756495?pr=157646#step:2:134

Exclude the common "context" word from this label rule.

See negation example at https://github.com/actions/labeler/blob/main/README.md#basic-examples.
@jmagman jmagman requested a review from andrewkolos October 28, 2024 21:41
auto-submit bot added a commit that referenced this pull request Oct 29, 2024
…7812)

Reverts: #157650
Initiated by: jmagman
Reason for reverting: this made the labeler go crazy and put it on everything that didn't contain "context".
Original PR Author: jmagman

Reviewed By: {christopherfujino}

This change reverts the following previous change:
#157646 is being labeled by the PR labeler as "text-input" because it edited "con**text**_runner.dart". 
```
##[debug]     "**/*text*" pattern matched packages/flutter_tools/lib/src/context_runner.dart
```
https://github.com/flutter/flutter/actions/runs/11526508378/job/32090756495?pr=157646#step:2:134

Exclude the common "context" word from this label rule.

See negation example at https://github.com/actions/labeler/blob/main/README.md#basic-examples.
@github-actions github-actions bot removed the a: text input Entering text in a text field or keyboard related problems label Oct 30, 2024
@andrewkolos
Copy link
Contributor

To convince xcdevice observe to redirect to stdout it's being launched in an interactive shell /usr/bin/script -t 0 /dev/null /usr/bin/arch -arm64e xcrun xcdevice observe --usb

Where does the output usually go if not stdout?

@jmagman
Copy link
Member Author

jmagman commented Nov 5, 2024

To convince xcdevice observe to redirect to stdout it's being launched in an interactive shell /usr/bin/script -t 0 /dev/null /usr/bin/arch -arm64e xcrun xcdevice observe --usb

Where does the output usually go if not stdout?

If I recall from #58137 (comment) (though it was 4 years ago) it eventually goes to stdout but it waited until the buffer hit some size before writing it, so the output wasn't up-to-date and so we couldn't reliably parse the json since it was output in chunks.

I learned the trick from @cbracken in https://github.com/flutter/flutter/pull/12079/files#diff-5a9a07600dceb28cbe887a5a64a24b0aR502-R504, who filed an issue about a different command with a similar issue https://openradar.appspot.com/34420207

Copy link
Contributor

@andrewkolos andrewkolos left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

LGTM stamp from a Japanese personal seal

@jmagman jmagman added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 5, 2024
@auto-submit auto-submit bot merged commit b6fef5c into flutter:master Nov 5, 2024
138 checks passed
@jmagman jmagman deleted the xcdevice-observe-shutdown branch November 5, 2024 19:01
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 6, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Nov 6, 2024
flutter/flutter@29d40f7...73546b3

2024-11-06 [email protected] Add test for `image.loading_builder.0.dart` (flutter/flutter#158248)
2024-11-06 [email protected] Make flutter_tools use newest package:{native_assets_builder,native_assets_cli,native_toolchain_c} (flutter/flutter#158214)
2024-11-06 [email protected] Fix RawScrollbar examples and desktop test (flutter/flutter#158237)
2024-11-06 [email protected] Cleanup MenuAnchor and Improve DropdownMenu tests readability (flutter/flutter#158175)
2024-11-06 [email protected] Roll Flutter Engine from a3741d6248b7 to f03f11300a9d (2 revisions) (flutter/flutter#158222)
2024-11-06 [email protected] Update error message for Cocoapods support for synchronized groups/folders (flutter/flutter#158206)
2024-11-06 [email protected] Restore skipped iOS test by looping over `FakeAsync` elapse. (flutter/flutter#158204)
2024-11-06 [email protected] fix: ensure draggable_scrollable_sheet respects shouldCloseOnMinExtenâ�¦ (flutter/flutter#156338)
2024-11-06 [email protected] Roll Flutter Engine from e5e06c97c33c to a3741d6248b7 (14 revisions) (flutter/flutter#158218)
2024-11-06 [email protected] Forward fix `CupertinoDynamicColor` by adding `toARGB32()`. (flutter/flutter#158145)
2024-11-05 [email protected] Remove unused `enableObservatory` flag. (flutter/flutter#158202)
2024-11-05 [email protected] Remove observatory related TODO that is already fixed. (flutter/flutter#158205)
2024-11-05 [email protected] Factor out "shaker" class (flutter/flutter#157748)
2024-11-05 [email protected] Marks Mac_benchmark animated_complex_opacity_perf_macos__e2e_summary to be flaky (flutter/flutter#157424)
2024-11-05 [email protected] Increase subsharding for `Linux tool_integration_tests` (flutter/flutter#158196)
2024-11-05 [email protected] Add test for `raw_scrollbar.2.dart` (flutter/flutter#158161)
2024-11-05 [email protected] use root directory as the default for rootOverride in Cache.test constructor (flutter/flutter#158201)
2024-11-05 [email protected] Kill interactive script job `xcdevice observe` processes on tool/daemon shutdown (flutter/flutter#157646)
2024-11-05 [email protected] Fix: Gap between prefix and suffix icon and input field in input decoâ�¦ (flutter/flutter#152069)
2024-11-05 [email protected] Roll Flutter Engine from f56401062e42 to e5e06c97c33c (1 revision) (flutter/flutter#158194)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop autosubmit Merge PR when tree becomes green via auto submit App tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"flutter daemon" leaves orphaned "xcdevice observe" processes around after being terminated

3 participants