Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTS plugin segmentation fault #26

Closed
cmouse opened this issue Oct 9, 2019 · 8 comments
Closed

FTS plugin segmentation fault #26

cmouse opened this issue Oct 9, 2019 · 8 comments

Comments

@cmouse
Copy link
Contributor

cmouse commented Oct 9, 2019

Dovecot version: 2.3.8
FTS Xapian version: 1.2.1
OS: Buster

When running doveadm index, it crashes with signal 11 with following backtrace:

Program received signal SIGSEGV, Segmentation fault.
__strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:65
65	../sysdeps/x86_64/multiarch/strlen-avx2.S: No such file or directory.
(gdb) bt full
#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:65
No locals.
#1  0x00007ffff71f6d72 in fts_backend_xapian_set_box (backend=backend@entry=0x555555650650, box=box@entry=0x555555660e98) at fts-backend-xapian-functions.cpp:506
        mb = 0x5555555f6630 "b806fb2788f0835af80e0000c56b215c"
        l = <optimized out>
        tp = {tv_sec = 93824993391744, tv_usec = 4699836487209397248}
#2  0x00007ffff71fb47f in fts_backend_xapian_get_last_uid (_backend=0x555555650650, box=0x555555660e98, last_uid_r=0x7fffffffe334) at fts-backend-xapian.cpp:159
        backend = 0x555555650650
#3  0x00007ffff766521a in fts_backend_get_last_uid (backend=<optimized out>, box=box@entry=0x555555660e98, last_uid_r=last_uid_r@entry=0x7fffffffe334) at fts-api.c:102
        hdr = {last_indexed_uid = 32767, settings_checksum = 4155205337, unused = 32767}
#4  0x00007ffff766afc9 in fts_mailbox_get_last_cached_seq (box=0x555555660e98, seq_r=0x7fffffffe364) at fts-storage.c:85
        flist = <optimized out>
        seq1 = 21845
        seq2 = 2049
        last_uid = 0
#5  0x00007ffff766b105 in fts_mailbox_get_status (box=0x555555660e98, items=<optimized out>, status_r=0x7fffffffe480) at fts-storage.c:110
        fbox = <optimized out>
        seq = 0
#6  0x00007ffff7c69ee7 in mailbox_get_status (box=box@entry=0x555555660e98, items=items@entry=(STATUS_MESSAGES | STATUS_LAST_CACHED_SEQ), status_r=status_r@entry=0x7fffffffe480) at mail-storage.c:1980
        __func__ = "mailbox_get_status"
#7  0x000055555558a719 in cmd_index_box_precache (box=0x555555660e98) at doveadm-mail-index.c:47
        ctx = 0x555555650460
        metadata = {guid = '\000' <repeats 15 times>, virtual_size = 0, physical_size = 0, first_save_date = 0, cache_fields = 0x0, precache_fields = (MAIL_FETCH_STREAM_HEADER | MAIL_FETCH_STREAM_BODY | MAIL_FETCH_RECEIVED_DATE | MAIL_FETCH_SAVE_DATE | MAIL_FETCH_PHYSICAL_SIZE | MAIL_FETCH_VIRTUAL_SIZE | MAIL_FETCH_UIDL_BACKEND | MAIL_FETCH_GUID | MAIL_FETCH_POP3_ORDER), backend_ns_prefix = 0x0, backend_ns_type = (unknown: 0)}
        counter = 0
        max = <optimized out>
        status = {messages = 775, recent = 0, unseen = 0, uidvalidity = 1518596232, uidnext = 1435, first_unseen_seq = 0, first_recent_uid = 1433, last_cached_seq = 775, highest_modseq = 0, highest_pvt_modseq = 0, keywords = 0x0, permanent_flags = 0, flags = 0, permanent_keywords = false, allow_new_keywords = false, nonpermanent_modseqs = false, no_modseq_tracking = false, have_guids = true, have_save_guids = true, have_only_guid128 = false}
        mail = 0x41392c6262892c00
        ret = 0
        trans = 0x0
        search_args = 0x7fffffffe420
        seq = <optimized out>
        status = <optimized out>
        trans = <optimized out>
        search_args = <optimized out>
        ctx = <optimized out>
        mail = <optimized out>
        metadata = <optimized out>
        seq = <optimized out>
        counter = <optimized out>
        max = <optimized out>
        ret = <optimized out>
        __func__ = "cmd_index_box_precache"
#8  cmd_index_box (info=<optimized out>, info=<optimized out>, ctx=0x555555628ee8) at doveadm-mail-index.c:136
        box = 0x555555660e98
        status = {messages = 4155205337, recent = 32767, unseen = 0, uidvalidity = 0, uidnext = 1432631424, first_unseen_seq = 21845, first_recent_uid = 4294960720, last_cached_seq = 32767, highest_modseq = 93824992889840, highest_pvt_modseq = 93824992892952, keywords = 0x555555643cf8, permanent_flags = 4157009018, flags = 32767, permanent_keywords = false, allow_new_keywords = false, nonpermanent_modseqs = false, no_modseq_tracking = false, have_guids = false, have_save_guids = false, have_only_guid128 = false}
        ret = 0
        box = <optimized out>
        status = <optimized out>
        ret = <optimized out>
#9  cmd_index_run (_ctx=0x555555628ee8, user=0x555555658508) at doveadm-mail-index.c:208
        _data_stack_cur_id = 2
        ctx = 0x555555628ee8
        iter = 0x555555660a88
        info = <optimized out>
        i = <optimized out>
        ret = 0
#10 0x0000555555584bcf in doveadm_mail_next_user (ctx=0x555555628ee8, error_r=0x7fffffffe650) at doveadm-mail.c:462
        cctx = <optimized out>
        input = {parent_event = 0x0, module = 0x0, service = 0x5555555bfc40 "doveadm", username = 0x5555555f3520 "bjarne@takeonestudios.dk", session_id = 0x0, session_id_prefix = 0x0, session_create_time = 0, local_ip = {family = 0, u = {ip6 = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0, 0, 0}}}, ip4 = {s_addr = 0}}}, remote_ip = {family = 0, u = {ip6 = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0, 0, 0}}}, ip4 = {s_addr = 0}}}, local_port = 0, remote_port = 0, userdb_fields = 0x0, flags_override_add = (unknown: 0), flags_override_remove = (unknown: 0), no_userdb_lookup = false, debug = false, conn_secured = false, conn_ssl_secured = false}
        error = 0x0
        ip = <optimized out>
        ret = 0
        __func__ = "doveadm_mail_next_user"
#11 0x000055555558582d in doveadm_mail_cmd_exec (ctx=0x555555628ee8, wildcard_user=0x0) at doveadm-mail.c:653
        cctx = 0x7fffffffe840
        cli = true
        ret = <optimized out>
        error = 0x7ffff7ab66d9 <__x86_return_thunk+5> "\363\220\017\256\350\353\371H\215d$\b\303\350\a"
#12 0x000055555558663a in doveadm_cmd_ver2_to_mail_cmd_wrapper (cctx=0x7fffffffe840) at doveadm-mail.c:1144
        mctx = 0x555555628ee8
        wildcard_user = <optimized out>
        fieldstr = 0x5555555bfc71 "-u"
        pargv = {arr = {buffer = 0x555555629128, element_size = 8}, v = 0x555555629128, v_modifiable = 0x555555629128}
        full_args = {arr = {buffer = 0x5555556290a8, element_size = 8}, v = 0x5555556290a8, v_modifiable = 0x5555556290a8}
        i = <optimized out>
        cli = true
        tcp_server = false
        mail_cmd = {alloc = 0x55555558a360 <cmd_index_alloc>, name = 0x5555555c2baf "index", usage_args = 0x5555555c1690 "[-u <user>|-A] [-S <socket_path>] [-q] [-n <max recent>] <mailbox mask>"}
        dashdash = 0x5555555c319a "--"
        args_pos = 3
#13 0x0000555555596e15 in doveadm_cmd_run_ver2 (argc=4, argv=0x5555555fab08, cctx=0x7fffffffe840) at doveadm-cmd.c:575
        param = <optimized out>
        pargv = {arr = {buffer = 0x5555555f2cc0, element_size = 104}, v = 0x5555555f2cc0, v_modifiable = 0x5555555f2cc0}
        opts = <optimized out>
        pargc = 7
        c = <optimized out>
        li = 21845
        pool = 0x5555555f29f0
        optbuf = <optimized out>
        __func__ = "doveadm_cmd_run_ver2"
#14 0x0000555555596e67 in doveadm_cmd_try_run_ver2 (cmd_name=cmd_name@entry=0x5555555fab75 "index", argc=<optimized out>, argv=<optimized out>, cctx=cctx@entry=0x7fffffffe840) at doveadm-cmd.c:497
        cmd = <optimized out>
#15 0x0000555555575b91 in main (argc=<optimized out>, argv=<optimized out>) at doveadm.c:391
        cctx = {cmd = 0x555555607788, argc = 7, argv = 0x5555555f2cf8, username = 0x5555555f3520 "bjarne@takeonestudios.dk", local_ip = {family = 0, u = {ip6 = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0, 0, 0}}}, ip4 = {s_addr = 0}}}, remote_ip = {family = 0, u = {ip6 = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0, 0, 0}}}, ip4 = {s_addr = 0}}}, local_port = 0, remote_port = 0, conn_type = DOVEADM_CONNECTION_TYPE_CLI, input = 0x0, output = 0x0}
        cmd_name = 0x5555555fab75 "index"
        i = 6
        quick_init = false
        c = <optimized out>
(gdb) p *box
$1 = {name = 0x555555661208 "INBOX", vname = 0x555555661200 "INBOX", storage = 0x55555565d548, list = 0x55555565cd38, event = 0x555555665950, v = {is_readonly = 0x7ffff7c93860 <maildir_storage_is_readonly>, enable = 0x7ffff7ce5390 <index_storage_mailbox_enable>, exists = 0x7ffff7cc73f0 <index_list_exists>, open = 0x7ffff7ccbf70 <mailbox_list_index_open_mailbox>, close = 0x7ffff7cea570 <mail_thread_mailbox_close>, free = 0x7ffff7cea4a0 <mail_thread_mailbox_free>, create_box = 0x7ffff7ccc220 <mailbox_list_index_create_mailbox>, update_box = 0x7ffff7ccbeb0 <mailbox_list_index_update_mailbox>, delete_box = 0x7ffff7ce6010 <index_storage_mailbox_delete>, rename_box = 0x7ffff7ce6040 <index_storage_mailbox_rename>, get_status = 0x7ffff766b040 <fts_mailbox_get_status>, get_metadata = 0x7ffff7cc82e0 <index_list_get_metadata>, set_subscribed = 0x7ffff7ce6640 <index_storage_set_subscribed>, attribute_set = 0x7ffff524e580, attribute_get = 0x7ffff524e220, attribute_iter_init = 0x7ffff524eed0, attribute_iter_next = 0x7ffff524dbd0, attribute_iter_deinit = 0x7ffff524db00, list_index_has_changed = 0x7ffff7c94d10 <maildir_list_index_has_changed>, list_index_update_sync = 0x7ffff7c94eb0 <maildir_list_index_update_sync>, sync_init = 0x7ffff7cca010 <mailbox_list_index_sync_init>, sync_next = 0x7ffff7ce8310 <index_mailbox_sync_next>, sync_deinit = 0x7ffff766b3a0 <fts_sync_deinit>, sync_notify = 0x7ffff766b4f0 <fts_mailbox_sync_notify>, notify_changes = 0x7ffff7c92750 <maildir_notify_changes>, transaction_begin = 0x7ffff766c830 <fts_transaction_begin>, transaction_commit = 0x7ffff766c520 <fts_transaction_commit>, transaction_rollback = 0x7ffff766b8a0 <fts_transaction_rollback>, get_private_flags_mask = 0x7ffff7c931a0 <maildir_get_private_flags_mask>, mail_alloc = 0x7ffff7cd89f0 <index_mail_alloc>, search_init = 0x7ffff766c950 <fts_mailbox_search_init>, search_deinit = 0x7ffff766b950 <fts_mailbox_search_deinit>, search_next_nonblock = 0x7ffff766bb20 <fts_mailbox_search_next_nonblock>, search_next_update_seq = 0x7ffff766bf10 <fts_mailbox_search_next_update_seq>, save_alloc = 0x7ffff7c90c10 <maildir_save_alloc>, save_begin = 0x7ffff7c90d30 <maildir_save_begin>, save_continue = 0x7ffff7c91090 <maildir_save_continue>, save_finish = 0x7ffff766ae70 <fts_save_finish>, save_cancel = 0x7ffff7c91750 <maildir_save_cancel>, copy = 0x7ffff766ada0 <fts_copy>, transaction_save_commit_pre = 0x7ffff7c91880 <maildir_transaction_save_commit_pre>, transaction_save_commit_post = 0x7ffff7c91760 <maildir_transaction_save_commit_post>, transaction_save_rollback = 0x7ffff7c917c0 <maildir_transaction_save_rollback>, is_inconsistent = 0x7ffff7ce61f0 <index_storage_is_inconsistent>}, vlast = 0x0, virtual_vfuncs = 0x0, pool = 0x555555660e70, metadata_pool = 0x0, prev = 0x0, next = 0x0, index = 0x555555667450, view = 0x555555668e50, cache = 0x555555668ba0, index_pvt = 0x0, view_pvt = 0x0, _perm = {file_uid = 1000, file_gid = 1000, file_create_mode = 384, dir_create_mode = 448, file_create_gid = 4294967295, file_create_gid_origin = 0x555555661990 "/srv/mail/takeonestudios.dk/bjarne", gid_origin_is_mailbox_path = true, mail_index_permissions_set = true}, _path = 0x555555661940 "/srv/mail/takeonestudios.dk/bjarne", _index_path = 0x555555661968 "/srv/mail/takeonestudios.dk/bjarne", reason = 0x555555661938 "index", mail_vfuncs = 0x7ffff7d6aee0 <maildir_mail_vfuncs>, set = 0x0, open_error = MAIL_ERROR_NONE, input = 0x0, index_prefix = 0x555555661210 "dovecot.index", flags = MAILBOX_FLAG_IGNORE_ACLS, transaction_count = 0, attribute_iter_count = 0, enabled_features = (unknown: 0), partial_cache = {uid = 0, physical_start = 0, physical_pos = 0, virtual_pos = 0}, vsize_hdr_ext_id = 4, pop3_uidl_hdr_ext_id = 6, box_name_hdr_ext_id = 7, box_last_rename_stamp_ext_id = 8, mail_vsize_ext_id = 5, recent_flags = {arr = {buffer = 0x555555674000, element_size = 8}, v = 0x555555674000, v_modifiable = 0x555555674000}, recent_flags_prev_uid = 1434, recent_flags_count = 2, tmp_sync_view = 0x0, notify_callback = 0x0, notify_context = 0x0, to_notify = 0x0, to_notify_delay = 0x0, notify_files = 0x0, generation_sequence = 3, search_results = {arr = {buffer = 0x555555661220, element_size = 8}, v = 0x555555661220, v_modifiable = 0x555555661220}, module_contexts = {arr = {buffer = 0x5555556612e0, element_size = 8}, v = 0x5555556612e0, v_modifiable = 0x5555556612e0}, opened = true, mailbox_deleted = false, creating = false, deleting = false, mailbox_undeleting = false, delete_sync_check = false, deleting_must_be_empty = false, delete_skip_empty_check = false, marked_deleted = false, inbox_user = true, inbox_any = true, disable_reflink_copy_to = false, disallow_new_keywords = false, synced = true, mail_cache_disabled = false, update_first_saved = false, skip_create_name_restrictions = false, corrupted_mailbox_name = false}
(gdb) p *backend
$2 = {backend = {name = 0x7ffff71ff4f6 "xapian", flags = FTS_BACKEND_FLAG_NORMALIZE_INPUT, v = {alloc = 0x7ffff71f65b0 <fts_backend_xapian_alloc()>, init = 0x7ffff71f6920 <fts_backend_xapian_init(fts_backend*, char const**)>, deinit = 0x7ffff71f6cc0 <fts_backend_xapian_deinit(fts_backend*)>, get_last_uid = 0x7ffff71fb460 <fts_backend_xapian_get_last_uid(fts_backend*, mailbox*, uint32_t*)>, update_init = 0x7ffff71f6ea0 <fts_backend_xapian_update_init(fts_backend*)>, update_deinit = 0x7ffff71f6490 <fts_backend_xapian_update_deinit(fts_backend_update_context*)>, update_set_mailbox = 0x7ffff71f6e50 <fts_backend_xapian_update_set_mailbox(fts_backend_update_context*, mailbox*)>, update_expunge = 0x7ffff71fa1e0 <fts_backend_xapian_update_expunge(fts_backend_update_context*, uint32_t)>, update_set_build_key = 0x7ffff71f6650 <fts_backend_xapian_update_set_build_key(fts_backend_update_context*, fts_backend_build_key const*)>, update_unset_build_key = 0x7ffff71f64c0 <fts_backend_xapian_update_unset_build_key(fts_backend_update_context*)>, update_build_more = 0x7ffff71faea0 <fts_backend_xapian_update_build_more(fts_backend_update_context*, unsigned char const*, size_t)>, refresh = 0x7ffff71f64d0 <fts_backend_xapian_refresh(fts_backend*)>, rescan = 0x7ffff71f6550 <fts_backend_xapian_rescan(fts_backend*)>, optimize = 0x0, can_lookup = 0x7ffff7664e10 <fts_backend_default_can_lookup>, lookup = 0x7ffff71fb1a0 <fts_backend_xapian_lookup(fts_backend*, mailbox*, mail_search_arg*, fts_lookup_flags, fts_result*)>, lookup_multi = 0x0, lookup_done = 0x0}, ns = 0x555555650460, updating = false}, path = 0x0, box = 0x0, oldbox = 0x0, db = 0x0, dbw = 0x0, dbr = 0x0, partial = 0, full = 0, nb_updates = 0, perf_pt = 0, perf_nb = 0, perf_uid = 0, perf_dt = 0}
(gdb) p mb
$3 = 0x5555555f6630 "b806fb2788f0835af80e0000c56b215c"
(gdb) p backend->path
$4 = 0x0

The cause seems to be accessing backend->path, which has not been initialized.

@cmouse
Copy link
Contributor Author

cmouse commented Oct 9, 2019

The root cause is missing/invalid fts_xapian setting, somehow to initialization error does not percolate correctly.

@grosjo
Copy link
Owner

grosjo commented Oct 12, 2019

Please check with recent changes

@grosjo
Copy link
Owner

grosjo commented Oct 20, 2019

@cmouse Has recent changes solved the issue ?

@grosjo
Copy link
Owner

grosjo commented Oct 31, 2019

@cmouse ?

@cmouse
Copy link
Contributor Author

cmouse commented Oct 31, 2019

Sorry yes. I'll give it a try.

@cmouse
Copy link
Contributor Author

cmouse commented Nov 1, 2019

In file included from fts-backend-xapian.cpp:51:0:
fts-backend-xapian-functions.cpp: In function ‘XResultSet* fts_backend_xapian_query(Xapian::Database*, XQuerySet*, long int)’:
fts-backend-xapian-functions.cpp:646:14: warning: no previous declaration for ‘XResultSet* fts_backend_xapian_query(Xapian::Database*, XQuerySet*, long int)’ [-Wmissing-declarations]
 XResultSet * fts_backend_xapian_query(Xapian::Database * dbx, XQuerySet * query, long limit=0)
              ^~~~~~~~~~~~~~~~~~~~~~~~
fts-backend-xapian-functions.cpp: In function ‘bool fts_backend_xapian_index_hdr(Xapian::WritableDatabase*, uint, const char*, const char*, long int, long int)’:
fts-backend-xapian-functions.cpp:684:6: warning: no previous declaration for ‘bool fts_backend_xapian_index_hdr(Xapian::WritableDatabase*, uint, const char*, const char*, long int, long int)’ [-Wmissing-declarations]
 bool fts_backend_xapian_index_hdr(Xapian::WritableDatabase * dbx, uint uid, const char* field, const char* data,long p, long f)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
fts-backend-xapian-functions.cpp: In function ‘bool fts_backend_xapian_index_text(Xapian::WritableDatabase*, uint, const char*, const char*)’:
fts-backend-xapian-functions.cpp:752:6: warning: no previous declaration for ‘bool fts_backend_xapian_index_text(Xapian::WritableDatabase*, uint, const char*, const char*)’ [-Wmissing-declarations]
 bool fts_backend_xapian_index_text(Xapian::WritableDatabase * dbx,uint uid, const char * field, const char * data)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fts-backend-xapian-functions.cpp: In function ‘int fts_backend_xapian_empty_db_remove(const char*, const stat*, int)’:
fts-backend-xapian-functions.cpp:807:85: warning: unused parameter ‘sb’ [-Wunused-parameter]
 static int fts_backend_xapian_empty_db_remove(const char *fpath, const struct stat *sb, int typeflag)
                                                                                     ^~
fts-backend-xapian-functions.cpp: In function ‘int fts_backend_xapian_empty_db(const char*, const stat*, int)’:
fts-backend-xapian-functions.cpp:817:78: warning: unused parameter ‘sb’ [-Wunused-parameter]
 static int fts_backend_xapian_empty_db(const char *fpath, const struct stat *sb, int typeflag)
                                                                              ^~
fts-backend-xapian.cpp: In function ‘int fts_backend_xapian_init(fts_backend*, const char**)’:
fts-backend-xapian.cpp:63:79: warning: unused parameter ‘error_r’ [-Wunused-parameter]
 static int fts_backend_xapian_init(struct fts_backend *_backend, const char **error_r)
                                                                               ^~~~~~~
fts-backend-xapian.cpp: At global scope:
fts-backend-xapian.cpp:518:1: warning: missing initializer for member ‘fts_backend::ns’ [-Wmissing-field-initializers]
 };
 ^
fts-backend-xapian.cpp:518:1: warning: missing initializer for member ‘fts_backend::updating’ [-Wmissing-field-initializers]

@cmouse
Copy link
Contributor Author

cmouse commented Nov 1, 2019

Well it isn't crashing anymore at least.

@grosjo
Copy link
Owner

grosjo commented Nov 6, 2019

ok cool

@grosjo grosjo closed this as completed Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants