Open alexhk opened 3 years ago
Take a look at my configuration in the last comment of the following issue: https://github.com/lefcha/imapfilter/issues/211#
This is a bug, and the incorrect recovering connection
print outs is a proof of that. I know where the problem is and will have a fix soon.
@alexhk I pushed a fix, could you try with the latest Git version?
I experience a similar issue when imapfilter dies once in a while (a couple of times per month) and gets restarted by systemd.
Here's my setup (relevant details):
…
while true do
inbox = account.INBOX
…
if not inbox:enter_idle() then
sleep(60)
end
end
and here's the systemd log:
Mar 08 22:34:56 sajuuk imapfilter[2314]: imapfilter: idle request to user@domain.tld failed
Mar 08 22:34:56 sajuuk imapfilter[2314]: stack traceback:
Mar 08 22:34:56 sajuuk imapfilter[2314]: [C]: in ?
Mar 08 22:34:56 sajuuk imapfilter[2314]: [C]: in function 'error'
Mar 08 22:34:56 sajuuk imapfilter[2314]: /usr/share/imapfilter/mailbox.lua:41: in field '_check_result'
Mar 08 22:34:56 sajuuk imapfilter[2314]: /usr/share/imapfilter/mailbox.lua:1070: in method 'enter_idle'
Mar 08 22:34:56 sajuuk imapfilter[2314]: /home/stealth/.imapfilter/config.lua:37: in main chunk
Mar 08 22:34:56 sajuuk systemd[2104]: imapfilter.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Mar 08 22:34:56 sajuuk systemd[2104]: imapfilter.service: Failed with result 'exit-code'.
systemd unit:
Description=Imapfilter Mail Filter
Documentation="man:imapfilter(1)" "man:imapfilter_config(5)"
ConditionPathExists=%h/.imapfilter/config.lua
[Service]
Type=simple
ExecStart=/usr/bin/imapfilter -c %h/.imapfilter/config.lua
RestartSec=60
Restart=on-failure
[Install]
WantedBy=default.target
I can probably re-run impafilter with debug file enabled, but maybe these details can give you an idea on where to look.
Version 2.8.0 and onward has a new recovery mechanism that is a lot more powerful and flexible:
https://github.com/lefcha/imapfilter/blob/9e6661278572009a92a8e125c9b339232a9735a1/NEWS#L11-L13
Have you tried using that instead? There's an example here:
I apologize if this is long winded, I wanted to post this for years and it seems today is the day!
I have imapfilter running at a box that is local to the IMAP server and I am using a loop with idle.
I've been using it for a few years but it exits when the connection to the server gets interrupted (say mail server restart etc).
I tried the available options but I may have misunderstood something, since I am getting strange errors.
This is also with the latest version 2.7.5 from Github freshly built, so I don't think it's an old bug.
To illustrate, here my loop is running fine and I am intentionally shutting down the mail server for a few seconds before I start it up again.
Debug log:
These "special" characters are not a copy and paste error, that's what I have in the log. It also doens't seem a terminal issue, it's what I get in the log.
Error log:
At this point imapfilter exits.
I tried using the internal IP addresses instead of the mail server's domain names (mail.server.com) with
options.hostnames = false
but I get the same result.These are my options and structure of the script:
With
options.reenter = true
I get the following (imapfilter doesn't exit):imapfilter won't exit this way, but continue like this.
Any idea what the problem could be and how I could get this sorted out ?