[Bug 966568] Re: upowerd is consuming 100% of CPU

2016-11-03 Thread Mike Myers
This may be the same issue as
https://bugs.launchpad.net/ubuntu/+source/upower/+bug/861642

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/966568

Title:
  upowerd is consuming 100% of CPU

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/upower/+bug/966568/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 861642] Re: upowerd uses 100% cpu till killed

2016-10-28 Thread Mike Myers
I would like to use my Linux system to charge up my iOS devices, but I
don't want to "Trust this Computer" so maybe we can drill down further
on this bug.

As soon as I connect a locked iDevice (tested iOS 9 and iOS 10):

$ top

top - 12:22:28 up 24 days, 21:05,  2 users,  load average: 0.50, 0.56, 0.84
Tasks: 222 total,   2 running, 220 sleeping,   0 stopped,   0 zombie
%Cpu(s): 37.7 us,  2.8 sy,  0.0 ni, 59.1 id,  0.5 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  3917996 total,   228612 free,  2176052 used,  1513332 buff/cache
KiB Swap:  4063228 total,  3597580 free,   465648 used.  1188276 avail Mem 

  PID USER  PR  NIVIRTRESSHR S  %CPU %MEM TIME+ COMMAND
 2184 root  20   0  348112   5596   4800 R  70.4  0.1   3886:07 upowerd

upowerd itself doesn't tell me much:

$ upower --monitor
Monitoring activity from the power daemon. Press Ctrl+C to cancel.
[15:26:55.169]  device added: 
/org/freedesktop/UPower/devices/media_player_1_1

$ upower --monitor-detail
Monitoring activity from the power daemon. Press Ctrl+C to cancel.
[15:28:23.805]  device added: 
/org/freedesktop/UPower/devices/media_player_1_1
  native-path:  /sys/devices/pci:00/:00:14.0/usb1/1-1
  vendor:   Apple_Inc.
  model:iPod
  serial:   8b1d0ada9c849c62fd52263c3797034216608bf0
  power supply: no
  updated:  Wed 31 Dec 1969 07:00:00 PM EST (1477682903 seconds ago)
  has history:  yes
  has statistics:   no
  media-player
warning-level:   none
percentage:  0%
icon-name:  'battery-missing-symbolic'

perf top: it shows the top four items to be libgmp.so.10.3.0 in:
__gmpn_redc_1
__gmpn_sqr_basecase
__gmpn_mul_basecase
__gmpz_probab_prime_p

`perf top --sort=comm,dso` shows that the top item is upowerd, in
libgmp.so.10.3.0

This is a math library. I can only guess, but it may be doing math
operations to compute the UDID of the iOS device every time it tries to
communicate with it? Some SHA1 operations maybe.

To use strace on the upowerd process (PID 2184):

$ sudo strace -p 2184 -c
strace: Process 2184 attached
strace: [ Process PID=2184 runs in x32 mode. ]
strace: [ Process PID=2184 runs in 64 bit mode. ]
^Cstrace: Process 2184 detached
% time seconds  usecs/call callserrors syscall
-- --- --- - - 
 58.050.000101   196   sendto
 41.950.73   0 14494   getrusage
  0.000.00   024   close
  0.000.00   030 6 stat
  0.000.00   0 6   poll
  0.000.00   096   select
  0.000.00   024   socket
  0.000.00   024   connect
  0.000.00   096   recvfrom
-- --- --- - - 
100.000.000174 14890 6 total

$ sudo strace -p 2184 -e sendto -i
This shows that it is sending XML messages over and over again. For fuller 
output you can add `-s 999` ... these are XML formatted messages being sent to 
the iPod as part of some kind of iOS proprietary communications protocol.

You can verify using a USB capture via usbmon, that the host Linux
system is in an infinite loop asking the iPod for something. Wireshark
doesn't have a dissector for iOS vendor-specific interfaces and commands
but you can see the same XML messages traveling the USB bus that were
observed in strace.

Is this actually a bug in libimobiledevice ? This seems like a failure
to obey an iOS protocol. Supposedly I am already on the latest version:
my package is 1.2.0+dfsg-3~ubuntu0.2

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/861642

Title:
  upowerd uses 100% cpu till killed

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/upower/+bug/861642/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs