Thanks for your important questions, Zoltan!

> What CPU and how much memory do you have on that device?

It's an old AMD Phenom II X4 955 BE. Still, qt creator usually needs
much less than one full core when just editing code files and generally
works quite well. I have 8GB of memory.

> Were you monitoring during that "hanging" period what else was going
on in your system?

I looked at "top" and found that qtcreator uses 99% (out of 400%
theoretically possible with my 4 core CPU).

No monitoring other than that, but I reproduced the issue again. There
are two different /usr/share/qtcreator/ubuntu/scripts/device_version
processes running right now, and in total I counted more than 3 of them
since I started ubuntu-sdk. At least that's what I assume, I've
repeatedly called ps aux | grep script and each time, there are a few of
them active and they have new PIDs each time.

> Anyhow, QtCreator is a big and heavy application, it is not free from
bugs. If we find a resource leak, we will follow it up with the upstream
developer.

It's working quite nicely when I don't have my Android phone attached
via USB, so I don't think it's an upstream bug. Also worked fine when I
attached my phone with Ubuntu booted on it.

> [The device_version script] does not use much CPU or any system
resources. In your case it got confused because your android device had
the same ID as the earlier registered Ubuntu device (due to the dual
boot). Anyhow the SDK tries three times to discover the attached device
and then it gives up.

Yeah, the script itself seems to be relatively lightweight. However it's
executed in what appears to be an infinite loop on my system. So the
"three attempts" limit might not work correctly?

> Sorry my ignorance, but I am not a kernel guru. How does that script
proves that the qtcreator is forking 30 times a second?

Sorry, my post was not even close to clear enough about that. AFAIK the
shell command shows that there were ~300 new processes spawned within
the 10 seconds sleep period, because the PID of each grep call was
incremented by ~300 compared to the last grep. AFAIK, PIDs are chosen
incrementally, so each new process gets a PID of $lastPID+1, unless that
PID is already in use. So a "grep, wait 10 seconds, grep" sequence
should show that both grep PIDs are pretty similar on my relatively calm
desktop system. A difference of 300 between both PIDs tells me that my
system spawned 300 processes in 10 seconds. Since top shows nothing
unusual other than 99% qtcreator CPU usage, I assumed that most of the
300 processes were spawned by qtcreator (I suspect: by the qtcreator
ubuntu plugin).

I have now disconnected my phone from USB. top shows that qtcreator is
now down to 0.0%, but takes up 30% of my memory (ps shows RSS 2468524 –
2.4G, this might indicate a leak? Can't remember what qtcreator memory
usage is normal after 30 mins of idling in the background.).

Now let me repeat that command:
$ while true; do ps aux | grep OnlyFindGrepItself; sleep 10; done
x       6171  0.0  0.0  18980  2136 pts/0    S+   21:23   0:00 grep 
--color=auto OnlyFindGrepItself
x       6174  0.0  0.0  18980  2192 pts/0    S+   21:23   0:00 grep 
--color=auto OnlyFindGrepItself
x       6178  0.0  0.0  18980  2200 pts/0    S+   21:23   0:00 grep 
--color=auto OnlyFindGrepItself
So down to to a PID increase of 4 between grep calls, or ~0.4 forks per second 
(most of which are probably caused by the shell command itself).

I think that makes it relatively clear that connecting my phone causes
the issues, and since part of the issue is that qtcreator uses 99% CPU
according to top, I'd guess that the issue is in the qtcreator process.
Also, since I definitely have more than 3 invocations of the
device_version script, it is probably related to the script or the
invocation of the script, so it's probably a bug in the qtcreator ubuntu
plugin.

I hope this explains my thoughts a little better, though I do have some
doubts about it. So feel free to ask again if this was not clear enough.
:-)

To reproduce the issue, this time it was enough to plug in my phone,
then start the SDK. At first, it's not at 99% CPU – more like 40%. It
steadily needs more CPU time until it hits 99%. This goes on for some
time, then suddenly CPU usage drops and at that time, I have to restart
the SDK because I can no longer start the build or deploy the app to my
phone. Apparently the SDK is unable to spawn a new shell process. If the
CPU usage is caused by excessively calling the device_version script,
this explains the sudden CPU usage drop: the script can't be spawned
because qtcreator is unable to spawn new processes.

Thanks!

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

Title:
  Almost unusuable while non-Ubuntu device connected through adb

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/qtcreator-plugin-ubuntu/+bug/1456627/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to