Using multiple usbmuxd/libiphone clients fails
-
Nikias Bassen
I committed a little change to usbmuxd so that send operations are executed within a mutex. Try if that helps, if not perhaps we'll need another lock/unlock around the recv operations.
-
Martin S.
- State changed from new to open
Does it have to be caused by a concurrency issue? Even when doing nothing but calling one additional app (like having iFuse mount sitting there then calling ./iphone_id ) it already spits out the usb error -104 and fails to communicate at all. The mutex didn't help (tried it for the recv operations, too).
It must be some sort of communication/protocol badness as the packets sent by usbmuxd seem definitely wrong according to what the iphone syslog says. I think dumping the communication and checking what's wrong exactly in the packets is the only way to solve this.
Perhaps there had been some change in libiphone's recv functions which was not merged into the usbmuxd implementation?
I am testing this with an iPod Touch 1G using OS 2.1.
-
Nikias Bassen
Hmmm, this is something I didn't think of. My device is iPhone 3G with iPhoneOS 2.2. I changed usbmuxd debugging output a bit so that with -v -v -v -v or more you'll get the packet contents dumped aswell. You can update your log, but perhaps it's inside SSL communications; just give it a try. If it is, enable extensive debugging output from libiphone to get the unencrypted data so we can see what's going on.
-
Martin S.
Hmm, simply calling "iphone_id " already fails for me...
See new log at: http://gist.github.com/130078
Looks like I need to do an extensive output run aswell... -
Nikias Bassen
As a reference: http://pims.selfip.net/usbmuxd_iphone_id.log is a log doing the same (running usbmuxd and then just calling iphone_id serial). What's strange is that it receives a connection reset when iphone_id is about to send a UniqueDeviceID GetValue request.
What I noticed: the usbmuxd scan packet is sent over the first connection (fd=5) via the /var/run/usbmuxd socket. After receiving the list of devices, iphone_id calls usbmuxd_connect which will open another connection via usbmuxd's socket file (fd=6) which will then finally connect to the iphone. This seems to work, but about when the fd=5 connection is closed, the connection reset takes place for whatever reason, even if this connection is not between usbmuxd and the device, but between usbmuxd and iphone_id. Can you observe any delay about when the connection reset occurs?
-
Martin S.
Yep, I notice a delay where it seems the read timeout completely runs out (I think at "recv_buf_timeout: fd=5 recv returned 0"). The packet before the delay appears to be the one that causes the entries in the iphone syslog and causes it to reset.
-
Nikias Bassen
- State changed from open to resolved
Well, well. After a long debugging session (thanks Martin), this problem is history (at least I hope so).
-
Martin S.
Apparently the issue was a race condition when an usbmux connection is setup.
The problem even occurred on OS 3.0 but is fixed now.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.