imapfilter icon indicating copy to clipboard operation
imapfilter copied to clipboard

imapfilter: reading data through SSL; Connection reset by peer

Open stheine opened this issue 2 years ago • 4 comments

I can't get around that issue, even though I have the options set as described in various issues:

options.persist   = true
options.recover   = 'all'
options.reenter   = false

by workaround is using pcall():

while true do
  if pcall(enter_idle) then
    -- process filters
    ...
  else
    sleep(10)
  end
end

this way I don't have to rely on an outside process taking care for restarting imapfilter.

I would love to see imapfilter being more stable in that respect and automatically handle that - and maybe there is still something wrong with my options. and if that's not possible, having the pcall() workaround documented here might help others.

stheine avatar Nov 23 '23 18:11 stheine

Which version are you using?

The recovery mechanism was refactored in version 2.8.0: https://github.com/lefcha/imapfilter/blob/e6372b88e09a4d1c573b57270de6b40846825a8b/NEWS#L5-L9

So the 3 options you mentioned have been actually removed.

You can see some examples of the new mechanism at: https://github.com/lefcha/imapfilter/blob/e6372b88e09a4d1c573b57270de6b40846825a8b/samples/extend.lua#L131-L190

And of course at the imapfilter_config(5) man page.

lefcha avatar Nov 24 '23 10:11 lefcha

I'm using 2.8.1, but missed the fact that these options have gone (I might have realized that if there would have been a major version change, but probably I would have also missed it, since I came to those options through the old issues in git).

I see you recover() is internally calling pcall(), so you're using the same approach, with some wrapper and retry around. great!

now I'm trying this code:

function enter_idle()
  account.INBOX:enter_idle()
end

while true do
  success, errormsg = recover(enter_idle, 10)
  if success then
    -- process filters
    ...
  else
    -- still failed even in recover()
    sleep(10);
  end
end

but this gives me an error:

imapfilter: /usr/local/share/imapfilter/auxiliary.lua:76: attempt to call field 'pack' (a nil value)
stack traceback:
        /usr/local/share/imapfilter/auxiliary.lua:76: in function 'recover'
        /root/.imapfilter/config.lua:91: in main chunk

with config.lua:91 being the call to recover(). what am I doing wrong now?

stheine avatar Nov 24 '23 11:11 stheine

This error was caused by a bug that was fixed in https://github.com/lefcha/imapfilter/commit/7ddc109eac588acad6af59acad37d06fd1aef0d4.

Can you try again with the latest version v2.8.2?

lefcha avatar Dec 26 '23 19:12 lefcha

thanks, I can confirm, that the fixed version now works without my pcall() workaround (as similar code is now properly working inside the imapfilter module itself).

stheine avatar Jan 14 '24 14:01 stheine