Mailspring icon indicating copy to clipboard operation
Mailspring copied to clipboard

Syncing IMAP accounts continuously use the CPU

Open Plaristote opened this issue 8 years ago • 43 comments

Are there any related issues?

No.

What operating system are you using?

Archlinux (built from AUR)

What version of Mailspring are you using?

1.0.10-d250-d253

--

Do you have any third-party plugins installed? If so, which ones?

None.

Is the issue related to a specific email provider (Gmail, Exchange, etc.)?

IMAP, using a Gandi mail account.

Is the issue reproducible with a particular attachment, message, signature, etc?

Is this question relevant, considering it seems to be a syncing issue ? Should I be looking for something specific ?

--

What's happening ?

The main process that seems related with syncing one of my IMAP accounts eats up a lot of CPU. The command that launched that process is: /usr/share/mailspring/resources/app.asar.unpacked/mailsync.bin --mode sync. Nothing in the logs but the periodic "Manual update check". I'm currently "solving" the issue by sending SIGSTOP to the process, and unstop it to manually check my mails. The process does respond to SIGINT properly.

And the syncing does work : I sent myself an email to confirm it. It just eats an entire CPU for a couple of seconds on very short intervals.

Plaristote avatar Dec 13 '17 15:12 Plaristote

Hmm—this is interesting. Do you have more than one account linked to Mailspring? If so, is it just one of the mailsync processes that is using a lot of CPU, or both? I think this is probably an issue specific to the content of your mailbox, but it's hard to say. For clients that don't support CONDSTORE and QRESYNC, we poll the "top" of the mailbox every two minutes to look for changes, but it typically only takes a second or so and CPU usage shouldn't be that extreme.

Are you seeing CPU use more frequently than every two minutes, or just a large period of high CPU every two minutes? On macOS I'd ask for an Instruments profile of the process to dig in to this a bit further, not sure if there's something equivalently easy to do on Linux.

bengotow avatar Dec 14 '17 19:12 bengotow

I do have several accounts, and this only apply to one of them. The good news is, the mailbox that causes issues is relatively empty, so it shouldn't be too hard to find what causes the problem, if it comes from the mailbox content.

What I see is short periods of high CPU usage (between 2 and 6 seconds), all separated by an interval of a couple of seconds. Comparatively, the same process, for the mailbox that works nicely, has a very similar period of high CPU usage, but separated by an interval of a minute.

As for the profiling, I think Callgrind might be what we're looking for. I see that I should be able to launch the mailsync process with Callgrind, once I've found out what arguments need to be passed to have it watch the proper mailbox.

This is what I've tried:

export LD_LIBRARY_PATH=/usr/share/mailspring/resources/app.asar.unpacked
export CONFIG_DIR=$HOME/.config/Mailspring
export IDENTITY_SERVER=https://id.getmailspring.com

/usr/share/mailspring/resources/app.asar.unpacked/mailsync.bin \
  --identity IDENTITY_ID \
  --mode sync \
  --account ACCOUNT_ID \
  --orphan --verbose

I found IDENTITY_ID and ACCOUNT_ID in $CONFIG_DIR/config.json. I assumed I had to pick the id field for the only identity that was there, and for the account corresponding to the faulty mailbox. However, running this command just prints the usage help and exits.

Plaristote avatar Dec 15 '17 16:12 Plaristote

I just installed Mailspring (new user) on Linux Mint (18.3) and set up syncing to office365. It drove all 4 of my processors to 100% (continuous). I let it do that for 10 min (maybe it needed to figure itself out, hey...?) and then quit Mailspring, and they dropped to their normal well below 10%. Seems like a similar experience to OP? Don't know what other info to post.

I just encountered the same issue with Ubuntu 17.10, Mailspring 1.0.12-cf081332 and 4 mailboxes. Ended up killing the process.

tuomastik avatar Jan 04 '18 15:01 tuomastik

Actual: I'm also seeing this issue, where after selecting Quit from the mail program exits the program, but leaves two processes running: mailsync.bin from /usr/share/mailspring/resources/app.asar.unpacked/mailsync.bin The only known workaround is to kill the process(s) as mentioned above. That seems like a hack that users should not have to use.

Expected The program fully exits when I select Quit. It's not a matter of system resources (in my case), rather it's a matter of respecting what was requested by the user.

saildata avatar Jan 05 '18 23:01 saildata

I have two imap accounts linked but even with one the CPU usage is very high, all the time. I'm running Archlinux and installed mailspring from the AUR. It's completely unusable since it slows down my entire system. Too bad because mailspring looks very promising.

dmeijboom avatar Jan 24 '18 08:01 dmeijboom

Kubuntu 16.04, Mailspring 1.1.0

When running, my CPU runs at 50% (4 Cores, i5-8th). 1 Gmail account linked. After quitting mailspring, my CPU usage is around 10-15%.

Similar behavior also in =< 1.0.12

The "syncing mailbox" info button is always there. Maybe its stuck at syncing? Happy to provide some logs.

pat-s avatar Jan 24 '18 22:01 pat-s

Similar problem for me. Elementary OS Loki. Mailspring 1.1.4. Only one email account on Office365, though it is quite large.

One of the processors runs at 100% most of the time. In general the CPU usage is quite large when Mailspring is open or running in background, all driven by same file: /usr/share/mailspring/resources/app.asar.unpacked/mailsync.bin

Memory usage is not out of the ordinary.

The high CPU causes battery drain very quickly, and eventually the computer becomes unresponsive after about 10mins. Unresponsive only happens if Mailspring application is physically open, high CPU and battery drain happen when the actual application is closed but it is running in background (ie, the icon is in the alert bar at the top of screen). If I quit Mailspring altogether then the CPU usage goes back to normal.

Happy to send through any log files if that would help (though need direction as to where to get them!).

cdanielian avatar Feb 27 '18 20:02 cdanielian

I'm having this issue - it's killing my battery. Also on arch here.

Here is a bash script I made to kill mailspring after 5 minutes. It's the only way I can make the app usable at this point.

# Spawn a child process:
(mailspring) & pid=$!
# sleep for 5 mins then kill that process
(sleep 300 && kill -9 $pid) & 

tim-projects avatar Mar 01 '18 09:03 tim-projects

I'm having the same issue on OpenSuse 42.3

sikand avatar May 15 '18 21:05 sikand

Having the same issue, Ubuntu 18.04, 4 accounts, high cpu usage on a GMX account. Quitting the application (Via Quit menu entry) results in a system error saying:

The application Mailspring has closed unexpectedly.

ExecutablePath: /usr/share/mailspring/resources/app.asar.unpacked/mailsync.bin

mailsync.bin crashed with SIGSEGV in __memmove_avx_ualigned_erms()

Interesting enough, after the crash and restart, no high cpu usage anymore.

oliverbienert avatar Jul 29 '18 20:07 oliverbienert

Having the same issue here on Arch with two different systems. While on desktop it's largely unnoticeable being overcompensated through hardware, on a laptop (xps 9370) as soon as I launch Mailspring the fans immediately kick in and the CPU reached 70C and then gets cooled down to 65C, while the normal operating temperatures are around 45C. The load remains sustained until I quit the process.

szalishchuk avatar Aug 13 '18 04:08 szalishchuk

Having exact the same problem running arch on my laptop.

pat-s avatar Aug 13 '18 06:08 pat-s

I’m having the same issue on Kubuntu 18.04.1 with Mailspring 1.4.2, and five accounts: two GMail (one of them G Suite), one iCloud, one Yahoo, and a generic IMAP account. It’s been pegging a core of my 3770 (4c8t), causing a load average of 0.97 while it’s at the lock screen and I’m on my tablet.

kode54 avatar Oct 10 '18 04:10 kode54

Same same on Ubuntu 18.04 and Mailspring 1.4.2, one gmail and two generic Imap.

nfaivre avatar Oct 15 '18 07:10 nfaivre

Mailspring 1.4.2 is also unusable on my up to date Arch Linux system due to high CPU use. I'm using one Gmail and one IMAP account.

lillemets avatar Oct 23 '18 08:10 lillemets

Same here with Ubuntu 18.04 and Mailspring 1.5.0 -- added one gmail account and mailsync.bin processes are keeping CPU pegged at 75-100% and fans on full blast. I'll leave overnight to see if it is just initial sync...

estiens avatar Oct 24 '18 02:10 estiens

Same issue here, ubuntu 16.04 mailspring 1.5.0. with one (quite large) imap mailbox.

the mainprocess eat one core constantly as shown below

selection_319

selection_320

When leaving mailspring (by quitting the app), the main process remains running, eating 1 core as when mailspring is actually running (see bullet one in the screenshot below). When ending the process manually (see bullet 2), the core usage falls back to normal usage (here with firefox running and a bunch of open tabs).

selection_321

I'd like to buy mailspring for its pro features but this core cpu usage is a no go for me and I'm afraid this issue is not covered by mailspring team (one year nearly without any reaction). If you need further information, please let me know.

gwelr avatar Oct 25 '18 09:10 gwelr

same here on Ubuntu 16.04. Mailspring 1.5.0 image

renanss avatar Oct 25 '18 19:10 renanss

Same thing here on Manjaro 4.19, Mailspring 1.5.1-da141eaf

tiscal404 avatar Oct 30 '18 21:10 tiscal404