Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write unix /var/run/usbmuxd: write: broken pipe #460

Open
dokisha opened this issue Aug 12, 2024 · 0 comments
Open

write unix /var/run/usbmuxd: write: broken pipe #460

dokisha opened this issue Aug 12, 2024 · 0 comments

Comments

@dokisha
Copy link

dokisha commented Aug 12, 2024

Describe the bug

This bug has been happening for years now, but it happens so random that it was hard to deduce what is the root cause.

When go-ios is used normally it takes some time for the bug to occur, but when it does the device is permanently corrupted and needs to be rebooted.

Commands like ps, kill, and runwda stop working (but probably every command that uses lockdown)

To Reproduce
Steps to reproduce the behavior:

  1. Open two terminals

  2. Copy paste this code in both terminals and run it simultaneously

for n in {1..200}
do
    if go-ios ps --apps --udid=SOME_UDID 2>&1>error.log; then
        echo "Success"
    else
        echo "Command failed"
        cat error.log
    fi
done
  1. Wait a bit
  2. Lockdown/communication gets broken
  3. Commands (ps and runwda) start getting response:
{"level":"debug","msg":"Failed connecting to com.apple.instruments.remoteserver, trying com.apple.instruments.remoteserver.DVTSecureSocketProxy"}
{"EnableServiceSSL":true,"Port":60328,"Request":"StartService","Service":"com.apple.instruments.remoteserver.DVTSecureSocketProxy","level":"debug","msg":"Service started on device"}
{"channel_id":"com.apple.instruments.server.services.deviceinfo","level":"debug","msg":"Requesting channel"}
{"level":"debug","msg":"DTX Connection with EOF"}
{"level":"debug","msg":"i0.0 c0 t:Ack mlen:0 aux_len0 paylen0"}
{"channel_id":"com.apple.instruments.server.services.deviceinfo","error":"Timed out waiting for response for message:5 channel:0","level":"error","msg":"failed requesting channel"}
{"channel_id":"com.apple.instruments.server.services.deviceinfo","level":"debug","msg":"Channel open"}
{"level":"error","msg":"DeviceConnection failed writing 204 bytes, only 0 sent"}
{"level":"error","msg":"Failed sending: write unix @-\u003e/var/run/usbmuxd: write: broken pipe"}
{"channel_id":"com.apple.instruments.server.services.deviceinfo","error":"write unix @-\u003e/var/run/usbmuxd: write: broken pipe","level":"info","methodselector":"runningProcesses","msg":"failed starting invoking method"}
panic: runtime error: index out of range [0] with length 0

I really hope you can reproduce it and figure out what is causing this.

Expected behavior
Lockdown doesn't get broken and device doesn't need restart.

Desktop (please complete the following information):

  • OS: Ubuntu (but it happened also happend to me on Mac, as well as Windows to some people on discord)

Smartphone (please complete the following information):

  • Iphone 7, 8, 11, 13, it happens on any device
  • OS: 15.x, 16x, haven't tried on 17.x yet

Additional context
Tried to unpair, pair, remount dev images and reactivate. Can't kill lockdownd on device because to kill it lockdown has to work.

This bug has been mentioned several times in discord channel and in:
pull request from 2022
issue from 2021
issue from 2023

It is also mentioned in pymobiledevice3 forums but they seem to managed to mitigate it somehow.

I also think this bug occurs naturally even when only one runwda is executed enough times or certain conditions are met, something is not closing on lockdown connection, and it's only a matter of time pipe gets broken, steps to reproduce above only accelerate those conditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant