# My app consumes a CPU while doing nothing. What's it doing?

**URL:** <https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392>\
**Category:** Linux\
**Created:** [July 16, 2019, 4:25pm UTC](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392 "2019-07-16T16:25:06Z")\
**Posts on this page:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![Anthony\_G\_Cyphers](https://forum.xojo.com/user_avatar/forum.xojo.com/anthony_g_cyphers/32/16862_2.png) [@Anthony\_G\_Cyphers](https://forum.xojo.com/u/Anthony_G_Cyphers)\
**Post date:** [July 18, 2019, 5:52pm UTC](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392/21 "2019-07-18T17:52:10Z")

</div>

> [@445785:@Tim Streater](#):
>
> The thread implements a websocket server for an HTMLViewer to communicate with the rest of the app. It avoids having to use the StatusChanged and TitleChanged events which either no longer work on some platforms or are limited in how much data they can pass.

Also bear in mind that if your app listens with a socket then users may be presented with a dialog to allow internet connections for that app. Some users won’t like that.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [July 18, 2019, 6:41pm UTC](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392/22 "2019-07-18T18:41:39Z")

</div>

> [@445800:@Anthony Cyphers](#):
>
> Also bear in mind that if your app listens with a socket then users may be presented with a dialog to allow internet connections for that app. Some users won’t like that.

It listens just once, at startup, to localhost, and having connected does not listen again.

---

<div class="post-metadata">

**Author:** ![Anthony\_G\_Cyphers](https://forum.xojo.com/user_avatar/forum.xojo.com/anthony_g_cyphers/32/16862_2.png) [@Anthony\_G\_Cyphers](https://forum.xojo.com/u/Anthony_G_Cyphers)\
**Post date:** [July 18, 2019, 6:42pm UTC](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392/23 "2019-07-18T18:42:15Z")

</div>

Yes, but they still get the message. I had the same idea with my components and my alpha test got backlash.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [July 18, 2019, 7:13pm UTC](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392/24 "2019-07-18T19:13:00Z")

</div>

Which platform, and does it happen at every launch of the app or just when it’s run the first time?

---

<div class="post-metadata">

**Author:** ![Anthony\_G\_Cyphers](https://forum.xojo.com/user_avatar/forum.xojo.com/anthony_g_cyphers/32/16862_2.png) [@Anthony\_G\_Cyphers](https://forum.xojo.com/u/Anthony_G_Cyphers)\
**Post date:** [July 18, 2019, 7:14pm UTC](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392/25 "2019-07-18T19:14:02Z")

</div>

If I remember correctly, Windows would ask on first launch (but not subsequent launches) and macOS was asking on every launch. I don’t recall what Linux users reported as there are so few.

---

<div class="post-metadata">

**Author:** ![Anthony\_G\_Cyphers](https://forum.xojo.com/user_avatar/forum.xojo.com/anthony_g_cyphers/32/16862_2.png) [@Anthony\_G\_Cyphers](https://forum.xojo.com/u/Anthony_G_Cyphers)\
**Post date:** [July 18, 2019, 7:15pm UTC](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392/26 "2019-07-18T19:15:43Z")

</div>

Either way, the issue was that they don’t want an app that shouldn’t be connecting to the internet popping up and asking to connect to the internet in this manner. When they say no because they’re security conscious, then the app breaks.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [July 18, 2019, 7:32pm UTC](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392/27 "2019-07-18T19:32:26Z")

</div>

Mmmm. I need a way for an HTMLViewer to communicate to the rest of the app. My options for doing this keep shrinking, apparently.

---

<div class="post-metadata">

**Author:** ![Anthony\_G\_Cyphers](https://forum.xojo.com/user_avatar/forum.xojo.com/anthony_g_cyphers/32/16862_2.png) [@Anthony\_G\_Cyphers](https://forum.xojo.com/u/Anthony_G_Cyphers)\
**Post date:** [July 18, 2019, 7:33pm UTC](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392/28 "2019-07-18T19:33:18Z")

</div>

Chunk the data through the event. I spent a lot of time looking for alternatives and there aren’t any without major caveats.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [July 18, 2019, 7:37pm UTC](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392/29 "2019-07-18T19:37:18Z")

</div>

> [@445829:@Anthony Cyphers](#):
>
> Chunk the data through the event. I spent a lot of time looking for alternatives and there aren’t any without major caveats.

Been there, done that. Works reasonably well for macOS and IIRC Linux. But under Windows, each chunk was taking 200msec or so. You only need a few k of data for that to become too slow.

---

<div class="post-metadata">

**Author:** ![Anthony\_G\_Cyphers](https://forum.xojo.com/user_avatar/forum.xojo.com/anthony_g_cyphers/32/16862_2.png) [@Anthony\_G\_Cyphers](https://forum.xojo.com/u/Anthony_G_Cyphers)\
**Post date:** [July 18, 2019, 7:41pm UTC](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392/30 "2019-07-18T19:41:41Z")

</div>

Oh, I know. I have two data-heavy components built this way, but it is what it is.

---

<div class="post-metadata">

**Author:** ![Anthony\_G\_Cyphers](https://forum.xojo.com/user_avatar/forum.xojo.com/anthony_g_cyphers/32/16862_2.png) [@Anthony\_G\_Cyphers](https://forum.xojo.com/u/Anthony_G_Cyphers)\
**Post date:** [July 18, 2019, 8:55pm UTC](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392/31 "2019-07-18T20:55:34Z")

</div>

OK, @ and I have been messing with this. Using the loopback interface doesn’t popup the firewall dialog on Windows 10. Will be re-testing on macOS shortly.

---

<div class="post-metadata">

**Author:** ![Anthony\_G\_Cyphers](https://forum.xojo.com/user_avatar/forum.xojo.com/anthony_g_cyphers/32/16862_2.png) [@Anthony\_G\_Cyphers](https://forum.xojo.com/u/Anthony_G_Cyphers)\
**Post date:** [July 18, 2019, 9:17pm UTC](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392/32 "2019-07-18T21:17:29Z")

</div>

Just finished my macOS test, and this appears to be working flawlessly there without the requests for permission. I still see them getting messages from apps like Little Snitch, so be sure to code a fallback so that your app doesn’t break if they deny in a third-party firewall and you should be good to go.

---

<div class="post-metadata">

**Author:** ![Anthony\_G\_Cyphers](https://forum.xojo.com/user_avatar/forum.xojo.com/anthony_g_cyphers/32/16862_2.png) [@Anthony\_G\_Cyphers](https://forum.xojo.com/u/Anthony_G_Cyphers)\
**Post date:** [July 18, 2019, 9:55pm UTC](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392/33 "2019-07-18T21:55:21Z")

</div>

Now just be sure you don’t leave any holes that can be exploited.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [July 19, 2019, 1:55pm UTC](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392/34 "2019-07-19T13:55:05Z")

</div>

I made a \<[https://xojo.com/issue/56420](https://xojo.com/issue/56420)\> for the CPU usage issue.

Thanks for the reports that use of the loopback (“localhost”) does not trigger a demand for my inside leg measurement. Barmy it would have been, but then OS vendors have been fairly barmy of late.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [April 29, 2021, 4:00pm UTC](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392/35 "2021-04-29T16:00:56Z")

</div>



[Previous page](https://forum.xojo.com/t/my-app-consumes-a-cpu-while-doing-nothing-whats-it-doing/49392.md?page=1)
