Главная > Freebsd > dovecot crash core или просто «падение в корку»

dovecot crash core или просто «падение в корку»

4 305

Столкнулся с таким в логах:

pid 39621 (imap), uid 26: exited on signal 11 (core dumped)

Занятно, но exim в связке c dovecot продолжал работать. Пришлось искать дамп imap. В конфигах я нигде не определял его будующее местонахождение, поэтому обратился на хомяк. Далее цитата с него:

Whenever Dovecot crashes, you see something like this in log file:

dovecot: Apr 23 11:16:05 Error: child 86116 (imap) killed with signal 11

No matter how that happened, it's a bug and will be fixed if you can provide enough information on how it happened. Best way is to get backtrace from gdb, but the problem is that Dovecot doesn't dump core files by default. You can solve this in a few ways:

Core Dumps

To get core dumps from crashes, there are a few things you must do. Newer Dovecot versions write to log if you got a core dump and if not, why:

  • core dumps disabled: Run ulimit -c unlimitedbefore starting Dovecot. If you start Dovecot using some script, note that they often override the limit.
    • Red Hat: echo 'DAEMON_COREFILE_LIMIT="unlimited"' >> /etc/sysconfig/dovecot
  • core not dumped - is home dir set?: Dovecot probably didn't have enough permissions to write to the current directory.
    • Make sure users have a writable home directory returned by userdb imap/pop3 processes chdir there. Set mail_debug=yes and make sure Dovecot logs the correct home directory.
    • Linux: You can specify where core gets written, e.g.: echo "/var/core/%p" > /proc/sys/kernel/core_pattern
    • FreeBSD: You can specify core location with kern.corefile sysctl.
  • non-Linux: You may need to set mail_drop_priv_before_exec = yesto enable core dumps from imap/pop3 processes.
    • FreeBSD: You can instead enable kern.sugid_coredump sysctl.
  • core dumped: Core file was successfully written! Now you'll just need to find it. See below.

After all this is done, you should find a file named core or sometimes core.pid where pid is a changing number. In BSDs it may also be called program_name.pid (e.g. imap.pid). This file is is in directory:

  • imap, pop3, deliver: User's home directory
  • imap-login, pop3-login: base_dir/login/ (e.g. /var/run/dovecot/login/)
  • others: base_dir/ (e.g. /var/run/dovecot/)

Getting backtrace from core dump goes like:

gdb /usr/local/libexec/dovecot/imap /path/to/core
..
(gdb) bt full
#0  0x40048a51 in kill () from /lib/libc.so.6
#1  0x40048872 in raise () from /lib/libc.so.6
#2  0x40049986 in abort () from /lib/libc.so.6
... etc ...

Note that the core file must have been produced by the exact same binary you're giving to gdb, otherwise the backtrace is broken. If all you are seeing are numbers or lots of "??" lines, the backtrace is broken.

Так и поступим:

#  sysctl kern.corefile=1
kern.corefile: %N.core -> 1
# sysctl kern.sugid_coredump=1
kern.sugid_coredump: 0 -> 1

Итак.. следующий обвал и смотрим:

# gdb /usr/local/libexec/dovecot/imap /tmp/imap.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...(no debugging symbols found)...
Core was generated by `imap'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/lib/libiconv.so.3...(no debugging symbols found)...done.
Loaded symbols for /usr/local/lib/libiconv.so.3
Reading symbols from /usr/lib/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/librt.so.1
Reading symbols from /lib/libc.so.7...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /usr/local/lib/dovecot/imap/lib10_quota_plugin.so...(no debugging symbols found)...done.
Loaded symbols for /usr/local/lib/dovecot/imap/lib10_quota_plugin.so
Reading symbols from /usr/local/lib/dovecot/imap/lib11_imap_quota_plugin.so...(no debugging symbols found)...done.
Loaded symbols for /usr/local/lib/dovecot/imap/lib11_imap_quota_plugin.so
Reading symbols from /usr/local/lib/dovecot/imap/lib11_trash_plugin.so...(no debugging symbols found)...done.
Loaded symbols for /usr/local/lib/dovecot/imap/lib11_trash_plugin.so
Reading symbols from /libexec/ld-elf.so.1...(no debugging symbols found)...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x00000000111046b2 in trash_plugin_deinit () from /usr/local/lib/dovecot/imap/lib11_trash_plugin.so

Видно что у меня проблема с плагином lib11_trash_plugin.so

Categories: Freebsd Tags: , , , ,
  1. Lutsk.name
    18 сентября 2012 в 22:44 | #1

    +1

  2. status-vk
    31 июля 2012 в 13:59 | #2

    Совсем недавно попал на ваш блог, теперь каждый день захожу глянуть, а не написали ли чего нового. :) Но, к сожалению, вы далеко не каждый день свой блог обновляете :(

  1. Пока что нет уведомлений.

.