Conversation
… if the emulator is missing
Contributor
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dx serve --android(without--device) boots the first AVD instart_android_sim. The emulator was spawned with tokio'sCommand::output(), which unconditionally re-sets stdout/stderr toStdio::piped(), overriding theStdio::null()calls just above it (whose comment says they exist to "prevent accumulating huge amounts of mem usage"). So everything the emulator prints for its whole lifetime was collected into aVecinside dx, and then dropped without ever being logged.Now the emulator is
spawn()ed with piped stdout/stderr, read line by line, and only the lastEMULATOR_LOG_TAIL_LINES(20) lines are kept. If it exits unsuccessfully, dx logs a warning with the exit status and that tail, e.g.:Previously such a failure was completely silent under dx. stdin is now
Stdio::null()rather than inherited.The two
.unwrap()s in the spawned task are replaced with warnings, so a missing/unrunnableemulatorbinary logsFailed to list Android emulators using ...instead of panicking the task.Why the output is not forwarded to
tracingForwarding each line with
tracing::debug!was tried and rejected. In serve mode every trace event is pushed onto the TUI's unbounded channel regardless of level and filtered afterwards. With a stub emulator emitting 1GB of lines in interactive mode, dx RSS reached 7.6GB and was still growing, and the build was starved. Showing live emulator output at--verbosewould need that channel bounded or filtered at the source first.Context and what this does not claim
This came out of investigating a user report of a system-wide freeze about 15s after
dx serve --androidon NixOS/AMD (not reproduced). The emulator launch is the main thingservedoes thatbuilddoes not, and this bug was found while reading that path. It is not established that the buffering causes the reported freeze: on a healthy emulator (37.1.11, API 35 image, software rendering) the output was only about 10KB in 90s. It would only matter if the emulator logs heavily, e.g. in an error loop.Testing
emulatorwriting 200MB to stdout: dx RSS rose from about 60-80MB to 258MB.dx serve --example hello_world --android(adb devicesshowsemulator-5554,sys.boot_completed=1), and keeps running after dx exits (it ignores SIGPIPE; same as before this change).cargo fmt --all -- --checkpasses.cargo clippy -p dioxus-cli --all-targetsreports no warnings in the changed code.A single emulator output line with no newline is still buffered whole until its newline arrives.
Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/a52f9de27c0f464e89601c0520cf9486
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/a52f9de27c0f464e89601c0520cf9486?variant=devin-insiders
Requested by: @nicoburns