libimobiledevice / ideviceinstaller

Manage apps of iOS devices
https://libimobiledevice.org
GNU General Public License v2.0
1.23k stars 257 forks source link

ideviceinstaller hangs (stop working), again start working when remove device and reconnect back #22

Open umesh9690 opened 9 years ago

umesh9690 commented 9 years ago

ideviceinstaller hangs (stop working) very offen, and again start working when removed device(iOS device) and reconnect back to machine(mac).

i installed ideviceinstaller using following commands: $ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" $brew install --HEAD ideviceinstaller

any help highly appreciated...

srikanthsadhu commented 9 years ago

We have seen the same issue and if there is a automated way of replugging the connected device to mac , please help, like mount/unmount the device itself ???

any thoughts to this is appreciated.

srikanthsadhu commented 9 years ago

Any progress on this ? its limiting our Automated process!!!!! we are feeling we had to switch to another utility to install apps .

srikanthsadhu commented 9 years ago

Can we mark this as CRITICAL issue with IOS8.2 devices on yosemite , please.

srikanthsadhu commented 9 years ago

this seemed to be a known issue with libusbmuxd and they are hoping to release in 1.4.0 , till then work around would be , with in itunes turnoff Synch ipad through wifi in iTunes and restart the ipad. this should be resolved temporarily till new relaease comes out OR fix the code and rebuild the libs.

al007 commented 9 years ago

@srikanthsadhu , could you be more specific about the workaround? On my environment, the Sync with iPhone over Wi-Fi is tuned off, but the issue still reproducible with the phone. Thanks.

Here is some statistics: ideviceinstaller hangs with devices: iPhone 6+, iPad Air 2 ideviceinstaller does NOT hang with devices: iPhone 5, iPad Mini 2, iPod Touch

ericcastro commented 7 years ago

It seems this problem has never been addressed, and it is very inconvenient for all automation purposes.

The version you can install from Homebrew does not have this issue, but unfortunately that version is very old and it's not compatible with iOS 10.2

Any clues ??

nikias commented 7 years ago

@ericcastro does this happen with large .ipa files/dev app folders or is this a general problem?

ericcastro commented 7 years ago

I haven't been able to find a reliable way to reproduce the issue, but it happens quite often.

For example, doing ideviceinstaller -l works right after connecting the device, then leave the device connected for a while (work on some other stuff), come back, rerun ideviceinstaller -l, it hangs. Physically disconnecting and reconnecting the USB cable seems to be the only workaround, which, will defeat any automation purpose.

nikias commented 7 years ago

Oh, it's about that. Huh, weird. While there is no obvious reason for it to hang it actually just happened with one of my device that has been connected for weeks. This is really strange...

nikias commented 7 years ago

It hung after doing this:

19:07:39 notification_proxy.c:48 np_lock(): Locked
19:07:39 property_list_service.c:132 internal_plist_send(): sent 320 bytes
19:07:39 property_list_service.c:133 internal_plist_send(): printing 320 bytes plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Command</key>
        <string>ObserveNotification</string>
        <key>Name</key>
        <string>com.apple.mobile.application_installed</string>
</dict>
</plist>
19:07:39 notification_proxy.c:59 np_unlock(): Unlocked
19:07:39 notification_proxy.c:48 np_lock(): Locked

At this point it would normally send another ObserveNotification with 'com.apple.mobile.application_uninstalled' but it does nothing. I'll see what I can find out...

ericcastro commented 7 years ago

Thanks, hope is nothing too difficult. Note that current available version in Homebrew (v1.1.0) does not have this problem.

ericcastro commented 7 years ago

Nikias, I have noticed as someone mentioned in another issue (#62) that this problem is happening for a device that is being listed twice by idevice_id

➜  ideviceinstaller git:(master) ✗ idevice_id -l
7e7d61f48484abc3cbXXXXXXXXXXXXXXXXXXX
7e7d61f48484abc3cbXXXXXXXXXXXXXXXXXXX
0a47f5856f0bc16b54XXXXXXXXXXXXXXXXXXX
77cea2d5147ad8cc19XXXXXXXXXXXXXXXXXXX
1acf6165509b1b16fa7XXXXXXXXXXXXXXXXXXX

I have 4 devices connected, but the first one shows up twice. If I run ideviceinstaller -l -u 7e7d61f48484abc3cbXXXXXXXXXXXXXXXXXXX it hangs, but if I run it with any of the other UDIDs, it works.

Maybe this can give you a clue about what is causing this?

nikias commented 7 years ago

Ahhhhh right this is a problem indeed. I need to figure out if we can distinguish between wifi and non-wifi sync devices. In fact when I tested, it picked my wifi sync device, trying to list all the apps while I thought it would operate on the device connected via USB.

ericcastro commented 7 years ago

Now, I'm not sure why I get duplicate entries from idevice_id knowing that I do not have wifi sync enabled on any of my devices.

nikias commented 7 years ago

Can't really tell you that but usbmuxd is apparently listing them. They can be differentiated with ConnectionType USB|Network, but neither libusbmuxd nor libimobiledevice are handling that at all (connection type is ignored). This requires some refactoring and additional functionality, and will probably not be finished in the next release (which is total overdue) but in a later one. I also don't have wifi sync enabled, but I had it enabled in the past, so maybe it's cached. Or maybe Apple's usbmuxd doesn't care if it's enabled or not :)

mayureshshirodkar commented 7 years ago

@nikias Even i have been facing the same issue. Get 2 udid's on running idevice_id -l. Using iPhone 5S on OS version: 9.3.5

When can we expect a fix or is there a workaround for it?

mayureshshirodkar commented 7 years ago

I am working around this issue by connecting my phone and machine to different Wifi connections or using Mobile data. Doing that doesn't create multiple UDIDs for idevice_id -l.

ericcastro commented 7 years ago

@mayureshshirodkar if you don't need any sort of USB-through-Wi-Fi functionality in your project, you can use the fork that I created of libusbmuxd that addresses this problem by entirely ignoring any devices on WiFi, leaving only those connected via USB.

meaning you will no longer see duplicate UDIDs and ideviceinstaller and other tools depending on libusbmuxd will not freeze anymore.

make sure to remove all possible instances of libusbmuxd in your system before.

felyppers commented 5 years ago

Hey guys, I had this same issue this week and solved by disabling the wifi service in the MAC.

In your MAC, use the command below to list your network services networksetup -listallnetworkservices

Write down the service name similar to iPhone USB and run: networksetup -setnetworkserviceenabled SERVICE_NAME off

After that, restart your mobile and it should work, but I agree that should be a flag to ignore Wi-Fi connections, similar to "ios-deploy --no-wifi" flag.