mirror of
https://github.com/d99kris/nmail.git
synced 2026-04-27 02:06:00 +03:00
[GH-ISSUE #13] [Bug] Crash after some time in the list view, with no user action #12
Labels
No labels
bug
enhancement
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nmail#12
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Kabouik on GitHub (Jan 14, 2020).
Original GitHub issue: https://github.com/d99kris/nmail/issues/13
Originally assigned to: @d99kris on GitHub.
Sorry if you are hearing so much from me lately. :O
I've set up my work email account and nmail manages to fetch a handful of messages (some in the Trash, and everything else is in "Deleted items" because I have a forward/delete procedure in place), but every time I try to fetch e-mails from this latter folder, nmail crashes with the following output:
Here is the log file: log.txt
It may be worth noting that there are several thousand messages in this folder. The white space in "Deleted items" does not seem to be the issue because nmail successfully fetched like 10 or 12 messages from this folder.
Note also that the account was initially set in French in OWA, with folder names translated to French. The associated accents could not be displayed properly in nmail (I had some broken syntax instead), which is why I changed the region to English in case this was causing the fetching problem, but it turned out that it was not the issue.
@d99kris commented on GitHub (Jan 16, 2020):
Haha, no worries. :)
Ok that sounds like a bad bug. I haven't come across anything similar before. In the log file I see some low-level
libetpan(the librarynmailuses for receiving and sending mail) calls returning MAILIMAP_ERROR_STREAM before the crash. I suspect these could be caused by network connectivity issues, but there are probably other possibilities as well.If you open
nmailagain and try to access this folder, does it crash immediately again? Or is it somewhat intermittent?@Kabouik commented on GitHub (Jan 16, 2020):
It is not intermittent, it is crashing all the time, but sometimes in one second and sometimes in just a fraction of a second. It is the same from different networks and different machines (I tried the now usual Xubuntu chroot from SFOS, SFOS, and Solus). Networks I tried are work, home, and with 3G/4G. It crashes just in the deleted folders that contains all those messages, not in other folders that either contain no messages, or just a few.
I don't know if it really is related to the number of messages being fetched, because one other mail account I set up (disroot.org) had more than 15k messages in its folder and it fetched correctly). The crashes only happen with the Exchange account.
prefetch_levelis set to=1for all my accounts.@d99kris commented on GitHub (Jan 20, 2020):
Thanks for sharing the additional details. I think I'll need to add more debug logging to
nmailin order to troubleshoot this bug. I'll update here once I've added such logging.@d99kris commented on GitHub (Jan 21, 2020):
Improved debug logging has been implemented as of
2ecf580- if possible, try latestnmailand share the new log file. The new verbose logging may log email message content, so please review the log file before sharing it and remove any email message data that you don't want to share.@d99kris commented on GitHub (Jan 21, 2020):
As an alternative to posting the log-file publicly in this issue, you may send it directly to me - d99kris at gmail dot com - and I will delete the email directly after analysing the log file, and not read/use any email message content.
@Kabouik commented on GitHub (Jan 21, 2020):
Great. I'll send you that in a minute. Regarding the new debug logging feature, maybe it would be good to have two options for comprehensive logging or just the previous level of details, since the new comprehensive logging can cause unnecessary privacy issues in other cases?
@d99kris commented on GitHub (Jan 28, 2020):
Thanks for sharing the log file. Somehow gmail's aggressive spam-filtering had marked your email as spam, so I only saw it now. I'll take a look now.
@d99kris commented on GitHub (Jan 28, 2020):
Hi, I suspect the issue occurs because nmail fetches message flags (read/unread, etc) for too many messages at a time. It looks like Outlook prefers imap requests to be max 10kb. So I've implemented some restriction, to only request flags for 1000 messages at a time. Hopefully this fixes the issue you've been seeing.
Please help to close the issue if it does solve the problem, or let me know if there are still issues.
@d99kris commented on GitHub (Jan 28, 2020):
Thanks for the feedback, I'll see what I can do to have a logging level that is still useful for debugging without causing privacy issues. I'll probably report a separate Github issue for this.
Edit: I've logged #19 for this.
@Kabouik commented on GitHub (Jan 28, 2020):
Unfortunately I am still having the issue with nmail crashing when fetching the big folder on the Exchange account. I tried again after deleting the cache but the issue persisted.
@Kabouik commented on GitHub (Jan 28, 2020):
Wait, dumb myself forgot to
git pullbefore building (…).@Kabouik commented on GitHub (Jan 28, 2020):
Yup, seems to work great now, thanks!
@Kabouik commented on GitHub (Jan 28, 2020):
However, this account still seems to have issue for sending emails. Receiving works, saving drafts works (but see #17), but sending always fails, with or without attachments, from drafts or newly composed message, while similar messages sent from other accounts work fine. Did you see something in the logs that may explain it? Else let me know and I can send you other logs when attempting to send an email.
@d99kris commented on GitHub (Jan 29, 2020):
Thanks for confirming!
May I propose we track that as a separate Github issue? I've reported #22 to track it.
I did not really look for any such things, and I have already deleted the log-file and your email. Could you please try reproduce the sending problem and share the log file with me?
I will proceed to close this issue.
@Kabouik commented on GitHub (Jan 30, 2020):
There seems to be remnants of this bug. The nmail session running for this Exchange account successfully fetches message, but it eventually crashes from the message list (without me doing anything).
@d99kris commented on GitHub (Jan 30, 2020):
Hm.. That is odd.. Could you please share the log-file as well, if you're able to reproduce the crash?
@Kabouik commented on GitHub (Jan 30, 2020):
Will do. I do not know how to reproduce it on demand, but it eventually occurs after minutes or perhaps hours; I just need to enable logging and be patient.
How can I record logs the old way, without saving the content of all messages? If I have to let nmail log data for minutes or hours, the file will be huge and will contain a lot of private information.
@d99kris commented on GitHub (Jan 31, 2020):
Just run
nmailwithout the-eflag, and make sureverbose_logging=0in the config file~/.nmail/main.conf.@d99kris commented on GitHub (Feb 5, 2020):
With the latest changes for #19 it should be fine to use
verbose_logging=1(or-eflag). If the resulting log file is very large you can try zip it, I think the compression ratio should be good.@d99kris commented on GitHub (Feb 10, 2020):
It would also be useful if you could try reproduce the problem with the latest version of
nmailas it adds some improved logging.Also, for for this latest crash, which OS did you observe it on, and what type of Internet connection was in use?
Thanks!
@Kabouik commented on GitHub (Feb 18, 2020):
Before I collect some logs and send them to you, just a short update to say that I noticed the issue can happen with non-Exchange accounts too. I observed it with my Disroot accounts today too.
I observed it on Solus (with
libetpanmissing some feature, mentioned it to the Solus dev team) with both Ethernet and Wifi. I'm not sure if I saw it on Xubuntu from chroot on my phone, it seems to be more stable, but I'll keep an eye on it.@d99kris commented on GitHub (Feb 19, 2020):
Thanks, this is useful information! When I get a chance I will try to reproduce it using my Solus installation with disroot.
@Kabouik commented on GitHub (Feb 19, 2020):
I think I only get this issue on Solus, so it might be related to
libetpan. It would be interesting to see if you can reproduce it withlibetpanfrom repository and compare with the version you built yourself.@Kabouik commented on GitHub (Feb 21, 2020):
I built
libetpanon Solus and still observe the issue. Let me know in case you fail to reproduce it with your installation and I'll try to collect some logs.@d99kris commented on GitHub (Feb 22, 2020):
I am able to see issues (such as "Get headers failed" and other "Get ... failed") with the combination Solus Linux and Disroot. It is possible the root cause to your crash is the same as the errors I see, but it would be good to confirm, for example by sharing the log. Do you also get "Get ... failed" errors btw?
Interestingly I don't see issues with Disroot on other OS'es (macOS or Ubuntu).
Nor do I see issues with Gmail or Hotmail under Solus Linux.
@d99kris commented on GitHub (Mar 8, 2020):
I've worked around the issue that I saw on my Solus Linux installation using disroot. Hopefully it fixes the issue for you too, if not please re-open the issue.
Dev notes: Solus Linux uses an end-of-life version of OpenSSL (1.0.2) which does not have the built-in thread-safety that OpenSSL >= 1.1.0 provides. When nmail AES decrypt operations fail (in this case due to trying to decrypt an empty file buffer) the global SSL state is affected, which may affect SSL communication with an email server. During troubleshooting an attempt was made to support OpenSSL 1.0.2 by registering necessary thread safety routines, only issue is that libetpan (which nmail uses for email server communication) overrides such registered routines without checking if already set or not. As OpenSSL 1.0.2 is EOL I decided to not to officially support this version, but still implement a workaround for 1.0.2 users which avoids a typical AES decrypt error for empty buffers.
@Kabouik commented on GitHub (Mar 11, 2020):
I'll need to open a new task on the Solus issue tracker to warn then about this issue, hopefully they will fix it.
Thanks a lot for taking the time to investigate yourself in another distribution, and implementing a workaround. I just pulled from git, I'll see if I still have the random crash issues.
@Kabouik commented on GitHub (Mar 14, 2020):
I still get crashes with the latest commit on Solus, including with Disroot. That was without doing any action, just
nmailsetting iddle in the list view. Can you reopen the issue (you told me to do so but I have no rights)?@d99kris commented on GitHub (Mar 14, 2020):
Oh no.. Ok, could you please help share the latest log?
@Kabouik commented on GitHub (Mar 14, 2020):
Wait, I'm stupid. I had two different
nmailsessions running concurrently on two different workspaces and got confused: the one that crashed is the Exchange one. I'll wait a bit to see if the other one (Disroot) crashes too.@Kabouik commented on GitHub (Mar 14, 2020):
I finally got a crash with Disroot as well, I'm sending the logs.
@d99kris commented on GitHub (Mar 14, 2020):
Hi @Kabouik - thanks for sharing the log files!
I found one issue with nmail (it shouldn't "crash" on SIGPIPE), so I fixed that and also added some improved crash logging (in case there is still some crash..). It's added in v1.53 /
f83ac26Please let me know if you still see crashes after this fix. Thanks!
@Kabouik commented on GitHub (Mar 14, 2020):
Thanks for the quick fix, I'll let you know.
@Kabouik commented on GitHub (Mar 17, 2020):
Still getting some crashes with both Exchange and Disroot, but more often with Exchange. I'm sending you the
-elogs.@Kabouik commented on GitHub (Mar 31, 2020):
After one day of use, I didn't get any crash with Disroot, but multiple crashes with Exchange. The crash is silent, no "unexpected termination" errors in the terminal after nmail closes (which was not the case with the crashes reported above). Changing
inbox=to a smaller folder inmain.confdidn't solve it.@Kabouik commented on GitHub (Jun 24, 2020):
I have been using
nmailfor several days consistently, I can confirm crashes are still frequent (< 1 hour) with Exchange, and rare with other servers (perhaps related to network changes and sleep/wake changes when moving places with the laptop).Not sexy, but useable to mitigate the issue, I use this alias for the Exchange account to relaunch
nmailwhenever it crashes:Now I'll need to enable logging and collect some data for you.
@d99kris commented on GitHub (Jun 24, 2020):
Okay that would be great. I'll reopen this issue so I don't loose track of it.
I personally have not encountered this type of stability issues, and I generally keep nmail running for weeks/months at a time. I don't generally use Exchange though, but I will try start a long Exchange session and see if I can reproduce any issue.
@Kabouik commented on GitHub (Jun 25, 2020):
I'm sending you some logs. Note that this time,
nmailcrashed and left the config directory locked:This does not happen all the time, but I observed that on a regular basis. I haven't found any way to unlock the config directory yet, there's no
nmailzombie process to kill, only logging out seemed to work so far. But both issues are probably different, since I often observe crashes that do not cause this.@Kabouik commented on GitHub (Jun 26, 2020):
Turns out the locked state happens when
nmailcrashes when using$EDITORin it because it leaves the process running:On the one hand, it could be handy because that means there might be ways to recover the
$EDITORbuffer after a crash (I lost messages I was composing because of that, didn't investigate if the editor was still running in the background and could be recovered), but on the other hand the locked state is an issue.I assume this could happen too with external viewers if
nmailcrashes while viewing attachments or message parts externally, unless it depends on whether the program is running inside thenmailwindow or not? Perhaps opening a different issue here would be relevant to implement a way fornmailto kill child processes when it crashes (or it may be irrelevant if crashes are fixed anyway).@d99kris commented on GitHub (Nov 24, 2020):
Thanks @Kabouik for sharing your extra verbose log-file via email. As mentioned in my email reply it's unfortunately still unclear what is happening, but I have some idea of additional logging I can add to
nmail. I will update this issue again once I've implemented the appropriate logging.@Kabouik commented on GitHub (Jan 12, 2021):
It may be worth noting that, while I get crashes at seemingly random times when nmail is idle in the message list, message view or compose view, sending an email seems to increase the probability of a crash.
As an example, it is not unusual to send an email with nmail and this Exchange account and get a crash right after hitting
Ctrl+xandy, somewhere between the "Sending" and the "Saving" statuses. Sometimes, sending went through and my recipient got the message. Sometimes not. Saving never goes through (crash happens before saving is over).@d99kris commented on GitHub (Jan 17, 2021):
Hi @Kabouik - I have created a simple script that allows you to run
nmailthrough a debugger (gdb) and capture the backtraces of all threads when crashing. Could you help to try runningnmailusing it and see if you can reproduce any crash?The script is located in the source package under
./util/debug-nmail.sh. If you use a custom nmail directory you need to adjust the beginning of the script and setARGSaccordingly, for example:Once you have encountered a crash, please review the generated log file and do a quick search either for
passor your actual plain text password, and make sure it is not there, before sharing the file. There is a possibility actual plain text password will be present, mainly if the crash happens during (IMAP or SMTP) authentication.@d99kris commented on GitHub (Jan 18, 2021):
FYI - An improvement to Linux crash logging was added in
a2b3bb9so it might not be necessary to reproduce the crash with./util/debug-nmail.sh(although it would probably simplify debugging). The nmail log file itself should contain most relevant information going forward.@d99kris commented on GitHub (Jan 18, 2021):
Do take note though that I simplified the logging options in
e51b9a5so now there's normal logging and verbose logging. The config paramverbose_loggingnow only supports0or1.@Kabouik commented on GitHub (Jan 22, 2021):
I just sent you some logs using the new logging feature, only to realize now that you said using the debug script would make it easier to debug. Sorry. I can do that too, let me know.
Note that
nmail --helpstill shows-eeas an option, but it has no effect (just shows the help message again).@d99kris commented on GitHub (Jan 23, 2021):
Thank you! I've looked through the log and unfortunately the new logging feature does not help. Yes, if you could try the
./util/debug-nmail.shscript it would be great.Thanks for catching - I've removed it from the --help in
b2d9301.@d99kris commented on GitHub (Feb 3, 2021):
Hi @Kabouik - thanks for sharing the logs from running
./util/debug-nmail.shvia email, I believe I've finally found and addressed the root cause. Please reopen the issue if you still encounter the crash.@d99kris commented on GitHub (Feb 3, 2021):
Root cause analysis for those interested:
The previous attempt to fix this bug was to remove the application-specific SIGPIPE signal handler. This was a mistake, because SIGPIPE defaults to application termination(!) which caused nmail to silently "crash", leaving no hints in the logs. The
debug-mail.shlog file provided made it clear that SIGPIPE still was crashing nmail. A quickman 7 signalconfirmed that(Term stands for terminating)
After finding this I did some googling and found this post https://securityboulevard.com/2018/10/tcp-ip-sockets-and-sigpipe/ which describes the SIGPIPE issue and other potential solutions to it.
For nmail the fix is to explicitly ignore SIGPIPE signals.
In the above commit we also improve general signal handling, to enable nmail to gracefully shutdown when requested by OS signalling.
@Kabouik commented on GitHub (Feb 3, 2021):
Awesome.