Fix "Failed to write while dumping service window: Broken pipe" - #351
Merged
Conversation
tgrushka
added a commit
to dra11y/python-androidtv
that referenced
this pull request
Aug 2, 2026
This PR: - fixes a broken pipe like in JeffLIrion#351, but from `grep -q` instead of `grep -m 1` - uses a much more efficient call to get idle state On Android 14, both `dumpsys power` greps no longer match. It prints `Display Power: com.android.server.power.PowerManagerService$1@a8a75e6` with no `state=` field, and `mScreenOn=true` is gone. So each poll, every 10 seconds, falls back to `dumpsys display`, a much more expensive call. Because `grep -q` terminates on first match, the pipe is broken, resulting in a stack trace every 10 seconds that looks like: ``` W FastPrintWriter: Write failure W FastPrintWriter: java.io.IOException: write failed: EPIPE (Broken pipe) W FastPrintWriter: at libcore.io.IoBridge.write(IoBridge.java:651) W FastPrintWriter: at java.io.FileOutputStream.write(FileOutputStream.java:432) W FastPrintWriter: at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:355) W FastPrintWriter: at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:378) W FastPrintWriter: at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:413) W FastPrintWriter: at android.os.Binder.dump(Binder.java:1158) W FastPrintWriter: at android.os.Binder.onTransact(Binder.java:1022) W FastPrintWriter: Caused by: android.system.ErrnoException: write failed: EPIPE (Broken pipe) W FastPrintWriter: at libcore.io.IoBridge.write(IoBridge.java:646) W FastPrintWriter: ... 9 more ``` This PR fixes the issue: - uses `dumpsys deviceidle get screen` to check power state, which is cheap and has been available since Android 7 - removes `-q` so grep will not stop on first match and cause broken pipe
tgrushka
added a commit
to dra11y/python-androidtv
that referenced
this pull request
Aug 2, 2026
This PR: - fixes a broken pipe like in JeffLIrion#351, but from `grep -q` instead of `grep -m 1` - uses a much more efficient call to get screen state On Android 14, both `dumpsys power` greps no longer match. It prints `Display Power: com.android.server.power.PowerManagerService$1@a8a75e6` with no `state=` field, and `mScreenOn=true` is gone. So each poll, every 10 seconds, falls back to `dumpsys display`, a much more expensive call. Because `grep -q` terminates on first match, the pipe is broken, resulting in a stack trace every 10 seconds that looks like: ``` W FastPrintWriter: Write failure W FastPrintWriter: java.io.IOException: write failed: EPIPE (Broken pipe) W FastPrintWriter: at libcore.io.IoBridge.write(IoBridge.java:651) W FastPrintWriter: at java.io.FileOutputStream.write(FileOutputStream.java:432) W FastPrintWriter: at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:355) W FastPrintWriter: at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:378) W FastPrintWriter: at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:413) W FastPrintWriter: at android.os.Binder.dump(Binder.java:1158) W FastPrintWriter: at android.os.Binder.onTransact(Binder.java:1022) W FastPrintWriter: Caused by: android.system.ErrnoException: write failed: EPIPE (Broken pipe) W FastPrintWriter: at libcore.io.IoBridge.write(IoBridge.java:646) W FastPrintWriter: ... 9 more ``` This PR fixes the issue: - uses `dumpsys deviceidle get screen` to check power state, which is cheap and has been available since Android 7 - removes `-q` so grep will not stop on first match and cause broken pipe
tgrushka
added a commit
to dra11y/python-androidtv
that referenced
this pull request
Aug 2, 2026
This PR: - fixes a broken pipe like in JeffLIrion#351, but from `grep -q` instead of `grep -m 1` - uses a much more efficient call to get screen state On Android 14, both `dumpsys power` greps no longer match. It prints `Display Power: com.android.server.power.PowerManagerService$1@a8a75e6` with no `state=` field, and `mScreenOn=true` is gone. So each poll, every 10 seconds, falls back to `dumpsys display`, a much more expensive call. Because `grep -q` terminates on first match, the pipe is broken, resulting in a stack trace every 10 seconds that looks like: ``` W FastPrintWriter: Write failure W FastPrintWriter: java.io.IOException: write failed: EPIPE (Broken pipe) W FastPrintWriter: at libcore.io.IoBridge.write(IoBridge.java:651) W FastPrintWriter: at java.io.FileOutputStream.write(FileOutputStream.java:432) W FastPrintWriter: at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:355) W FastPrintWriter: at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:378) W FastPrintWriter: at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:413) W FastPrintWriter: at android.os.Binder.dump(Binder.java:1158) W FastPrintWriter: at android.os.Binder.onTransact(Binder.java:1022) W FastPrintWriter: Caused by: android.system.ErrnoException: write failed: EPIPE (Broken pipe) W FastPrintWriter: at libcore.io.IoBridge.write(IoBridge.java:646) W FastPrintWriter: ... 9 more ``` This PR fixes the issue: - uses `dumpsys deviceidle get screen` to check screen state, which is cheap and has been available since Android 7 - removes `-q` so grep will not stop on first match and cause broken pipe
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.
Fixes #349