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

High cpu use #995

Closed
gerroon opened this Issue Nov 21, 2018 · 20 comments

Comments

Projects
None yet
7 participants
@gerroon

gerroon commented Nov 21, 2018

Hi

It seems like there is a new issue just sneaked in either in 115 or in 116.

Joplin seems to be using high cpu in the background while I am not interacting, like when it is in tray and it seems to be constant use. Since I am not a dev I do not how to debug this. Sometimes this usage goes for a long time sometimes couple minutes but rather frequently. I do not remember this issue before

See a snapshot below of how it looks (107 is the cpu usage)

PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 31689 USER 20 0 1059M 160M 64368 R 107. 2.0 10:07.67 /tmp/.mount_JoplindFzVZj/app/joplin --type=renderer --no-sandbox --primordia

Joplin 1.0.116 (prod, linux) Appimage, Debian Buster x64

@laurent22

This comment has been minimized.

Owner

laurent22 commented Nov 21, 2018

For me on Windows it's at 0% CPU when not in use. Is there something special about what's open when CPU usage is high? Like maybe a particularly large note, or with many images or Katex formulas? Does it do this with all the notes?

@gerroon

This comment has been minimized.

gerroon commented Nov 21, 2018

All my notes are simple text files with some urls mostly.

Here I am hearing my fan going nuts while I am replying to you. This issue was not resolved with a restart of Joplin.

I am not sure what you mean by all notes, llike I mentioned I am not interacting with it, it is in the tray while happening.

@laurent22

This comment has been minimized.

Owner

laurent22 commented Nov 21, 2018

I think I know, on Linux I've recently made a change to keep the app awake while sync is in progress, so maybe that's what's making the CPU usage abnormally high. Does it stop doing it if sync is stopped?

@gerroon

This comment has been minimized.

gerroon commented Nov 21, 2018

I am looking at it, it says sync completed but the cpu usage is still at 107 (moves between 105 and 108, 4 core intel here), which is interesting, it seems like some threads get stuck at certain usage.

@laurent22

This comment has been minimized.

Owner

laurent22 commented Nov 21, 2018

I'll remove this hack in the next release. I'm clueless as to why the UI is sleeping on Linux while sync is in progress, but that fix I've added doesn't seem to be the right one.

@gerroon

This comment has been minimized.

gerroon commented Nov 21, 2018

I cant go back to earlier versions since I started using dark theme :(

@Jestre

This comment has been minimized.

Jestre commented Nov 21, 2018

This seems to be a problem on MacOS as well. I installed it this morning via Homebrew, and after configuring sync it pulled in my 20 or so notes. I minimized it and about 20 minutes later I noticed the fan was running, so I checked Activity Monitor and noticed that Joplin Helper was at 110.9% CPU.

@CalebJohn

This comment has been minimized.

Contributor

CalebJohn commented Nov 21, 2018

@gerroon If the issue is that going back to an older version results in a messed up half light/half dark theme, you can just set the light theme before reverting back to an older version. If the issue is an attachment to the dark theme, then my apologies, I'm no help.

@laurent22

This comment has been minimized.

Owner

laurent22 commented Nov 21, 2018

What sync targets are you using? (Nextcloud, Dropbox, etc.)

@Jestre

This comment has been minimized.

Jestre commented Nov 21, 2018

What sync targets are you using? (Nextcloud, Dropbox, etc.)

Mine is Nextcloud

@laurent22

This comment has been minimized.

Owner

laurent22 commented Nov 21, 2018

I can't replicate this in either macOS nor Linux unfortunately, so more information will be needed. Any chance you could enable debug mode and see if you're getting any error or warning, or perhaps, suddenly many log statements in either the log file or console?

@laurent22

This comment has been minimized.

Owner

laurent22 commented Nov 21, 2018

Does it happen right away when you start the app, or only after a certain time?

Does it happen only when the app is in the tray or all the time?

Are there any changes when you sync or when sync stops?

@gerroon

This comment has been minimized.

gerroon commented Nov 21, 2018

That is all I have in the console and still using %107 cpu (set to verbose)

/tmp/.mount_JoplinIePbaP/app/resources/app/lib/logger.js:120 2018-11-21 14:01:35: "Starting Clipper server on port 41184"

In my case most of the time it seems to be using high cpu right away then repeatedly even if it goes regular levels after sometime

It happens all the time whether in tray or in background.

But there is a peculiar situation, it seems to start usingn high cpu when a note is not selected, ie "no notes in this category" message is avail, then if I select a note the cpu level drops right away.

@Jestre

This comment has been minimized.

Jestre commented Nov 21, 2018

But there is a peculiar situation, it seems to start usingn high cpu when a note is not selected, ie "no notes in this category" message is avail, then if I select a note the cpu level drops right away.

This seems to be the trigger: If I create a new Notebook and select it (thus receiving the above message), the CPU immediately spikes, and the following message is written to log.txt approximately 320 times per second:

2018-11-21 15:16:24: "Reducer action", "SET_NOTE_TAGS"

Thus

$ grep '2018-11-21 15:16:24' log.txt | wc -l
Wed Nov 21 15:16:43 2018
 321
@tessus

This comment has been minimized.

Collaborator

tessus commented Nov 21, 2018

I suggest to create a spin dump. In this case you can see where it is stuck....
Or on Linux force a stack trace and collect the gdb (core dump) file.

@gerroon

This comment has been minimized.

gerroon commented Nov 23, 2018

Any progress on this issue?

@laurent22

This comment has been minimized.

Owner

laurent22 commented Nov 24, 2018

2018-11-21 15:16:24: "Reducer action", "SET_NOTE_TAGS"

Looks like it's been introduced by #893. @Abijeet, any idea why it's calling this action in an infinite loop? I'd be tempted to rollback this feature for now, to give us time to look into it.

I think the fix would be to do side effects like setting note tags in the middleware, that should prevent rendering loops.

@laurent22 laurent22 closed this in 6f64fdf Nov 24, 2018

@laurent22

This comment has been minimized.

Owner

laurent22 commented Nov 24, 2018

@Abijeet, I have disabled the tag bar in the latest release as the CPU issue would need to be fixed. I've done so by adding a flag so that we can turn it back on once it's fixed.

@Abijeet

This comment has been minimized.

Contributor

Abijeet commented Nov 24, 2018

@laurent22 - I'll check this out.

@matsest

This comment has been minimized.

Contributor

matsest commented Dec 12, 2018

This would be a very useful feature. Hope you find a solution @Abijeet :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment