Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

100% of the CPU is used when there is no network #14510

Closed
friofry opened this issue Apr 24, 2024 · 6 comments · Fixed by status-im/status-go#5125
Closed

100% of the CPU is used when there is no network #14510

friofry opened this issue Apr 24, 2024 · 6 comments · Fixed by status-im/status-go#5125
Assignees
Labels
backend-team bug Something isn't working E:Desktop Performance Improvements MVP Tasks to improve performance and memory usage for MVP
Milestone

Comments

@friofry
Copy link
Contributor

friofry commented Apr 24, 2024

Bug Report

Description

When running Status Desktop without an Internet connection, CPU usage is very high.
Doesn't reproduce when network is enabled.

Steps to reproduce

  1. Turn off the network on the computer
  2. Launch the application

Expected behavior

CPU usage should be as low as possible (around 0-3%).

Actual behavior

High CPU usage on application startup

Additional Information

CPU usage is low when network is on

network_on.mp4

CPU usage is high when there is no network

no_network.mp4
  • Status desktop version: master on e8a78e21
image
  • Operating System: Macos
@friofry friofry added bug Something isn't working backend-team labels Apr 24, 2024
@jrainville jrainville added this to the 2.29.0 Beta milestone Apr 29, 2024
@jrainville jrainville added the E:Desktop Performance Improvements MVP Tasks to improve performance and memory usage for MVP label Apr 29, 2024
@jrainville
Copy link
Member

@friofry it should be easy to identify the source if you use something like hotspot. However, this one is for Linux, so you'd need to find a Mac version (I assume it exists somewhere).
If you can't find something that works for you, I can reassign to someone that's on Linux

@caybro
Copy link
Member

caybro commented May 1, 2024

@friofry it should be easy to identify the source if you use something like hotspot. However, this one is for Linux, so you'd need to find a Mac version (I assume it exists somewhere).
If you can't find something that works for you, I can reassign to someone that's on Linux

Hotspot is Linux exclusive

@friofry
Copy link
Contributor Author

friofry commented May 3, 2024

The issue is related to the manager.go StartTorrentClient() method.

image

(I'm using the MacOS CPU profiler from Instruments and building the application with INCLUDE_DEBUG_SYMBOLS=true).

If I comment out this call, the CPU usage is normal. I continue to investigate this issue.

@jrainville
Copy link
Member

Good find. If we can use some kind of function that can tell us if we have connection, then we can skip this function until connection is re-established. @richard-ramos might have an idea if we have such a function

@richard-ramos
Copy link
Member

The function SubscribeToConnStatusChanges in status-go could be used to determine if you're connected or not.
Here's an example on how it can be used: https://github.com/status-im/status-go/blob/8a0b7ddbb57bcf7e6a244bc15c3e0828c1f85f99/protocol/messenger_testing_utils.go#L194-L214

This function is available in Transport so I think it should be possible to call it from protocol/communities/messenger_communities.go and protocol/communities/manager.go (that's where I saw calls to StartTorrentClient and StopTorrentClient

@friofry
Copy link
Contributor Author

friofry commented May 3, 2024

The function SubscribeToConnStatusChanges in status-go could be used to determine if you're connected or not. Here's an example on how it can be used: https://github.com/status-im/status-go/blob/8a0b7ddbb57bcf7e6a244bc15c3e0828c1f85f99/protocol/messenger_testing_utils.go#L194-L214

This function is available in Transport so I think it should be possible to call it from protocol/communities/messenger_communities.go and protocol/communities/manager.go (that's where I saw calls to StartTorrentClient and StopTorrentClient

Thanks for the hint! I'll try this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend-team bug Something isn't working E:Desktop Performance Improvements MVP Tasks to improve performance and memory usage for MVP
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants