! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
High CPU usage with calculator enabled
Status:
RESOLVED: MOVED
Product:
Xfce4-calculator-plugin
Component:
General

Comments

Description Mikhail T. 2019-05-01 15:59:17 CEST
I'm running a FreeBSD guest inside a Windows host using Virtual Box. There are 4 CPUs and 8GB of RAM used by the guest (the host has 16GB).

Using the XFCE4 as the desktop, I have the following plugins enabled:

 . screenshot
 . clipboard
 . weather
 . clock

If I add the calculator plugin, top starts showing 20% CPU-utilization by the new wrapper-process, and 100% by the Xorg. Calculator works -- and the ability to refer to "pi" was a nice "Easter egg" -- but the rest of the GUI becomes "sticky". For example, scrolling through or typing into a gvim window my fingers manage to outpace the computer's reaction...

If either kill the wrapper (and the calculator with it) or "humanely" remove the calculator from the panel, things go back to normal. Removing/readding other plugins does not have this effect...
Comment 1 Mikhail T. 2019-05-01 16:48:31 CEST
Tracing the wrapper-process with FreeBSD's ktrace, I can see the constant pattern of:

[...]
 88205 wrapper-2.0 RET   writev 16384/0x4000
 88205 wrapper-2.0 CALL  recvmsg(0x3,0xbf7fbf38,0)
 88205 wrapper-2.0 RET   recvmsg -1 errno 35 Resource temporarily unavailable
 88205 wrapper-2.0 CALL  recvmsg(0x3,0xbf7fbf68,0)
 88205 wrapper-2.0 RET   recvmsg -1 errno 35 Resource temporarily unavailable
 88205 wrapper-2.0 CALL  poll(0xbf7fe6f8,0x1,0xffffffff)
 88205 wrapper-2.0 RET   poll 1
 88205 wrapper-2.0 CALL  writev(0x3,0xbf7fe7f8,0x3)
 88205 wrapper-2.0 GIO   fd 3 wrote 4096 bytes
       0x0000 3508 0400 9878 4702 ec74 4702 2200 1c00 8b04 0600 9978 4702 9878 4702 2300 0000 0004 0000 0100 0000 8b1a  |5....xG..tG."........xG..xG.#.............|
       0x002a 0700 0004 0600 9978 4702 0000 0000 0000 0000 0000 0000 2200 1c00 8b08 0900 0104 0600 0d00 4002 e75b 4102  |.......xG.............".............@..[A.|
       0x0054 9978 4702 0000 0000 0000 0000 0000 0000 2200 1c00 8b08 0900 08a3 4202 9978 4702 0000 0000 ed74 4702 0000  |.xG.............".........B..xG......tG...|
       0x007e 0000 0000 0000 0000 0000 2200 1c00 8b08 0900 0c00 0000 9778 4702 9978 4702 ed74 4702 0000 0000 0000 0000  |.........."............xG..xG..tG.........|

... repeat ...

[...]

I'm guessing, that's X-protocol communications with Xorg. What does the calculator have to say -- when I'm not even typing anything into it?
Comment 2 Andre Miranda editbugs 2019-05-02 21:38:02 CEST
I can't reproduce here (Arch Linux), the wrapper is stuck at 0% CPU no matter what I do.
Could be a FreeBSD + Xorg issue.
Comment 3 Mikhail T. 2019-05-03 17:19:43 CEST
I doubt, it is anything FreeBSD-specific. More likely to have to do with Virtual Box -- this is a FreeBSG-guest VM running inside a Windows desktop.

I'll check on my home machine tonight -- I don't normally use the calculator there. Meanwhile, even if the wrapper's CPU-load is low, you may still be able to see the problem by tracing the process on your Linux system (using strace). Unless the applet has the focus, it should be completely idle -- if you see it constantly doing something (like reading/writing on a socket or file), that's a bug...
Comment 4 Mikhail T. 2019-06-12 19:57:53 CEST
Ok, I tried it on my home machine -- where FreeBSD runs natively (rather than inside a VM) -- and it was even worse. Not only did the CPU load jump, when I added calculator to the panel, I actually _saw_ the constant flickering of the widget changing its size up and then back down a little bit. Constantly...

Not sure, what triggers this -- maybe, a mouse-entering (and/or -leaving) event -- or what...
Comment 5 Goran 2019-07-28 12:54:42 CEST
I can confirm this, I've tested v0.7.0 in a Docker container running Xubuntu 19.04, when the plugin is added to a panel, the CPU usage jumps and hovers around 25-30%, and it's libcalculator.so that's the culprit.

Oddly enough, if I click on the calculator's input field and hit Enter (the input has to be valid), or right-click and select "Hexadecimal output", the CPU usage basically drops to zero and stays that way, so I suppose this can be used as a temporary workaround...
Comment 6 Andre Miranda editbugs 2019-07-28 21:22:50 CEST
(In reply to Goran from comment #5)
> I can confirm this, I've tested v0.7.0 in a Docker container running Xubuntu
> 19.04, when the plugin is added to a panel, the CPU usage jumps and hovers
> around 25-30%, and it's libcalculator.so that's the culprit.
Are you referring to this https://github.com/schuellerf/xfce-test? How did you install calculator-plugin since it's not available in the official repository? From the source?
Just for the record, on my Arch system when the plugin is added I don't get the CPU spike.
Comment 7 Goran 2019-08-01 21:03:15 CEST
(In reply to Andre Miranda from comment #6)
> (In reply to Goran from comment #5)
> > I can confirm this, I've tested v0.7.0 in a Docker container running Xubuntu
> > 19.04, when the plugin is added to a panel, the CPU usage jumps and hovers
> > around 25-30%, and it's libcalculator.so that's the culprit.
> Are you referring to this https://github.com/schuellerf/xfce-test? How did
> you install calculator-plugin since it's not available in the official
> repository? From the source?
> Just for the record, on my Arch system when the plugin is added I don't get
> the CPU spike.

The latest Docker container comes with the calculator available (v0.7.0git-31b7df2), and I get the same behavior as described above. I've also tried reinstalling the plugin inside the container using GCC v9.1 instead of the default v8.3, but the issue remains.
Comment 8 Git Bot editbugs 2020-05-22 23:13:47 CEST
-- GitLab Migration Automatic Message --

This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/panel-plugins/xfce4-calculator-plugin/-/issues/1.

Please create an account or use an existing account on one of our supported OAuth providers. 

If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests

Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev

Bug #15346

Reported by:
Mikhail T.
Reported on: 2019-05-01
Last modified on: 2020-05-22

People

Assignee:
Xfce-Goodies Maintainers
CC List:
2 users

Version

Version:
unspecified

Attachments

Additional information