grosjo / fts-xapian

Dovecot FTS plugin based on Xapian
GNU Lesser General Public License v2.1
91 stars 19 forks source link

Breaks with dovecot 2.3.17 #99

Closed jfarjona closed 2 years ago

jfarjona commented 2 years ago

Hi, I just updated dovecot to 2.3.17 from 2.3.16 and this plugin breaks it:

Oct 30 16:43:45 mail dovecot: imap-login: Login: user=...@..., method=PLAIN, rip=x.x.x.x., lip=172.16.2.66, mpid=32490, TLS, session= Oct 30 16:43:45 mail dovecot: imap(...@....com)<32490>: Fatal: master: service(imap): child 32490 killed with signal 11 (core dumps disabled - https://dovecot.org/bugreport.html#coredumps)

I had to remove the plugin for dovecot to work.

-- Upgrade info: --- Upgrade: dovecot-lmtpd:amd64 (2:2.3.16-2+debian10, 2:2.3.17-3+debian10), dovecot-dev:amd64 (2:2.3.16-2+debian10, 2:2.3.17-3+debian10), dovecot-imapd:amd64 (2:2.3.16-2+debian10, 2:2.3.17-3+debian10), libisc-export1100:amd64 (1:9.11.5.P4+dfsg-5.1+deb10u5, 1:9.11.5.P4+dfsg-5.1+deb10u6), dovecot-sieve:amd64 (2:2.3.16-2+debian10, 2:2.3.17-3+debian10), dovecot-core:amd64 (2:2.3.16-2+debian10, 2:2.3.17-3+debian10), dovecot-managesieved:amd64 (2:2.3.16-2+debian10, 2:2.3.17-3+debian10), libwebkit2gtk-4.0-37:amd64 (2.32.4-1~deb10u1, 2.34.1-1~deb10u1), dovecot-ldap:amd64 (2:2.3.16-2+debian10, 2:2.3.17-3+debian10), libdns-export1104:amd64 (1:9.11.5.P4+dfsg-5.1+deb10u5, 1:9.11.5.P4+dfsg-5.1+deb10u6), gir1.2-webkit2-4.0:amd64 (2.32.4-1~deb10u1, 2.34.1-1~deb10u1), dovecot-pgsql:amd64 (2:2.3.16-2+debian10, 2:2.3.17-3+debian10), libjavascriptcoregtk-4.0-18:amd64 (2.32.4-1~deb10u1, 2.34.1-1~deb10u1), gir1.2-javascriptcoregtk-4.0:amd64 (2.32.4-1~deb10u1, 2.34.1-1~deb10u1)

Thanks,

Juan

grosjo commented 2 years ago

Problem is that dovecot 2.3.17 is buggy

grosjo commented 2 years ago

the coredump gives :

(gdb) bt full

0 fts_user_autoindex_exclude (box=, box@entry=0x55cf79d865c8) at fts-user.c:347

    fuser = <optimized out>

1 0x00007f1f31198496 in fts_mailbox_allocated (box=0x55cf79d865c8) at fts-storage.c:806

    flist = <optimized out>
    v = 0x55cf79d865f0
    fbox = 0x55cf79d86bf8

2 0x00007f1f31825ccc in hook_mailbox_allocated (box=box@entry=0x55cf79d865c8) at mail-storage-hooks.c:256

    _data_stack_cur_id = 5
    _foreach_end = 0x55cf79d77088
    _foreach_ptr = 0x55cf79d77078
    hooks = 0x7f1f311c6ba0 <fts_mail_storage_hooks>
    ctx = 0x55cf79d87df8

3 0x00007f1f31820ec1 in mailbox_alloc (list=0x55cf79d7dfd8, vname=0x7f1f318e439e "INBOX", flags=flags@entry=0) at mail-storage.c:885

    _data_stack_cur_id = 4
    new_list = 0x55cf79d7dfd8
    storage = 0x55cf79d7e7e8
    box = 0x55cf79d865c8
    open_error = MAIL_ERROR_NONE
    errstr = 0x0
    __func__ = "mailbox_alloc"

4 0x00007f1f3183138b in mailbox_list_mailbox (list=0x55cf79d7dfd8, name=name@entry=0x7f1f318e439e "INBOX", flags_r=flags_r@entry=0x7ffe66100d58) at mailbox-list.c:1554

    box = 0x55cf79d861b8
    existence = (MAILBOX_EXISTENCE_NOSELECT | MAILBOX_EXISTENCE_SELECT | unknown: 0x7f1c)
    ret = <optimized out>
    path = 0x55cf79d3012f <error: Cannot access memory at address 0x55cf79d3012f>
    fname = <optimized out>
    rootdir = <optimized out>
    dir = <optimized out>
    inbox = 0x55cf79d861b8 "\240b\330y\317U"
    len = <optimized out>

5 0x00007f1f31887736 in inbox_info_init (namespaces=0x55cf79d7de60, ctx=0x55cf79d861b8) at mailbox-list-iter.c:734

    flags = 0
    ret = <optimized out>
    flags = <optimized out>
    ret = <optimized out>
    __func__ = "inbox_info_init"

6 mailbox_list_iter_init_namespaces (namespaces=0x55cf79d7de60, patterns=patterns@entry=0x55cf79d7b850,

type_mask=type_mask@entry=(MAIL_NAMESPACE_TYPE_PRIVATE | MAIL_NAMESPACE_TYPE_SHARED | MAIL_NAMESPACE_TYPE_PUBLIC), 
flags=(MAILBOX_LIST_ITER_RETURN_CHILDREN | MAILBOX_LIST_ITER_RETURN_SPECIALUSE)) at mailbox-list-iter.c:777
    ctx = 0x55cf79d861b8
    i = <optimized out>
    count = 1
    pool = 0x55cf79d86190
    __func__ = "mailbox_list_iter_init_namespaces"
grosjo commented 2 years ago

@cmouse can you help with that ? thank you

cmouse commented 2 years ago

We are looking at this.

cmouse commented 2 years ago

This is because fts-xapian is not calling fts_mail_user_init anywhere. It should be called in mail_user_created hook.

grosjo commented 2 years ago

Kindly try latest git

cmouse commented 2 years ago

You need to also call fts_mail_user_deinit...

grosjo commented 2 years ago

@cmouse I add it and get in the logs: Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Timeout leak: 0x7f9c470c2a30 (mail-index-alloc-cache.c:265) Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Raw backtrace for leaks: #0 io_loop_destroy[0x7f9c46f228c0] -> #1 master_service_deinit[0x7f9c46e96d40] -> #2 main[0x55c69d657a80] -> #3 __libc_start_main[0x7f9c46c67a50] -> #4 _start[0x55c69d658010] Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7d02b0 leaked (parent=0x55c69d7c9220): mail-cache.c:578 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7c9220 leaked (parent=0x55c69d7c0e20): mail-index.c:67 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7c0e20 leaked (parent=0x55c69d7b51d0): index-storage.c:405 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7c0120 leaked (parent=0x55c69d7c1ef0): mail-cache.c:578 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7c1ef0 leaked (parent=0x55c69d7ee170): mail-index.c:67 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7ee170 leaked (parent=0x55c69d7b51d0): index-storage.c:405 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7ed470 leaked (parent=0x55c69d7e9d00): mail-cache.c:578 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7e9d00 leaked (parent=0x55c69d7e89f0): mail-index.c:67 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7e89f0 leaked (parent=0x55c69d7b51d0): index-storage.c:405 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7e7ee0 leaked (parent=0x55c69d7e41a0): mail-cache.c:578 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7e41a0 leaked (parent=0x55c69d7e1030): mail-index.c:67 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7e1030 leaked (parent=0x55c69d7b51d0): index-storage.c:405 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7b7d60 leaked (parent=0x55c69d796fd0): mail-index.c:67 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7b7420 leaked (parent=0x55c69d796fd0): fs-api.c:32 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7b5c70 leaked (parent=0x55c69d7b51d0): mail-index.c:67 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7b51d0 leaked (parent=0x55c69d796fd0): mail-storage.c:430 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d796fd0 leaked (parent=0x55c69d7aa9b0): mail-user.c:78 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7aa9b0 leaked (parent=0x55c69d7814b0): mail-storage-service.c:1359 Nov 1 12:56:35 gjserver dovecot[1191632]: imap(1191725): Warning: Event 0x55c69d7814b0 leaked (parent=(nil)): main.c:250

grosjo commented 2 years ago

@cmouse is this ok for you ? why such totally useles complexity ?

grosjo commented 2 years ago

@jfarjona This one shall be solved, right ?

jfarjona commented 2 years ago

Yes! It works fine now. Thank you very much.