Dovecot Internal Errors (3.1.13/Debian Stretch)

Discussion in 'ISPConfig 3 Priority Support' started by macguru, Apr 19, 2019.

  1. macguru

    macguru Member HowtoForge Supporter

    Hi !

    For whatever unknown reason I started to get problems with ISPConfig 3.1.13 setup on Debian Stretch just after restart. ISPConfig VM running on KVM/oVirt (as it did for a long time).
    ISPConfig web front-end shows no problems, mysql service running fine.
    As possible remedy, did "apt upgrade" which seem to refresh dovecot. However, I'm not sure it will help.
    Problem occurs once in several hours (usually day).
    Looks like dovecot for weird reason fails to connect to mysql, or my be loses connection socket. Yet all other software have no problem connecting to mysql.

    Similar issue is described here:
    https://dovecot.org/list/dovecot/2014-March/095417.html
    and here
    https://talk.plesk.com/threads/dovecot-lda-fatal-internal-error-occured.332748/
    This error occurrs because the socket file /var/run/dovecot/auth-userdb isn't present. This happened because Dovecot was abruptly ended during the operation. I suggest you check corresponding Postfix errors in maillog.


    Here are logs:
    mail.err
    Code:
    Apr 19 11:10:19 mail dovecot: auth: Error: plain(web3_xxx,ip.zzz.zzz.zzz,<vOZVnd2GJ5pUD8Nq>): Request 17735.1 timed out after 150 secs, state=1
    Apr 19 11:10:50 mail dovecot: lda([email protected]): Error: userdb lookup([email protected]): Request timed out
    Apr 19 11:10:50 mail dovecot: lda: Fatal: Internal error occurred. Refer to server log for more information.
    Apr 19 11:14:36 mail dovecot: lda: Fatal: Internal error occurred. Refer to server log for more information.
    Apr 19 11:14:36 mail dovecot: pop3-login: Error: read(anvil) failed: EOF
    Apr 19 11:17:03 mail dovecot: pop3-login: Error: read(anvil) failed: EOF
    Apr 19 11:17:03 mail dovecot: auth: Error: read(anvil-auth-penalty) failed: EOF
    Apr 19 11:17:03 mail dovecot: auth: Error: net_connect_unix(anvil-auth-penalty) failed: Connection refused
    
    mail.warn
    Code:
    Apr 19 11:14:36 mail dovecot: log: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
    Apr 19 11:15:05 mail postgrey[1150]: Couldn't unlink "/var/run/postgrey.pid" [Permission denied]
    Apr 19 11:16:19 mail postfix/postfix-script[19337]: warning: not owned by root: /var/spool/postfix/lib/x86_64-linux-gnu/libgcc_s.so.1
    Apr 19 11:16:19 mail postfix/postfix-script[19338]: warning: not owned by root: /var/spool/postfix/lib/x86_64-linux-gnu/libnss_mdns_minimal.so.2
    Apr 19 11:16:19 mail postfix/postfix-script[19339]: warning: not owned by root: /var/spool/postfix/lib/x86_64-linux-gnu/libnss_mdns6.so.2
    Apr 19 11:16:19 mail postfix/postfix-script[19340]: warning: not owned by root: /var/spool/postfix/lib/x86_64-linux-gnu/libnss_mdns.so.2
    Apr 19 11:16:19 mail postfix/postfix-script[19341]: warning: not owned by root: /var/spool/postfix/lib/x86_64-linux-gnu/libnss_mdns6_minimal.so.2
    Apr 19 11:16:19 mail postfix/postfix-script[19342]: warning: not owned by root: /var/spool/postfix/lib/x86_64-linux-gnu/libnss_mdns4.so.2
    Apr 19 11:16:19 mail postfix/postfix-script[19343]: warning: not owned by root: /var/spool/postfix/lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2 
     
    Last edited: Apr 19, 2019
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    For postfix, you might want to try these commands:

    postfix set-permissions
    postfix upgrade-configuration

    They will fix permissions if there is something broken.

    For dovecot, try to set a higher value for max_connections and max_user_connections in the mysql/mariadb config, e.g. try to set them to 1000. The values need to be set in the [mysqld] section of the config file:

    max_connections = 1000
    max_user_connections = 1000

    Maybe that helps.
     
  3. macguru

    macguru Member HowtoForge Supporter

    Hi, Till,
    OK, thanks.
    mariadb max connection already were 1000 for a long time.
    BTW, is there any ready to use shell script which checks health of dovecot processes and restarts if necessary ?
    For example in an absence of socket "/var/run/dovecot/auth-userdb" or failure of this process? I can write it myself but don't know all dovecot internals.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

  5. macguru

    macguru Member HowtoForge Supporter

    Checked /var/log/mail.warn, its full of these messages. Could it be a cause of dovecot misbehavior? How to re-build all sieve data? I did resync from ispconfig -> tools, warnings still present.

    Code:
     Apr 19 22:26:17 mail dovecot: lda([email protected]): Warning: sieve: file storage:
    Active sieve script symlink /var/vmail/mycompany.com/horizon/.sieve points to
    non-existent script (points to sieve/ispconfig.sieve).
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    If the resync does not add the missing file again, then there is probably no way to do it within ispconfig, except of activating something that writes the sieve file like settings a filter, checking the move to spam checkbox or adding an autoresponder.
     
  7. macguru

    macguru Member HowtoForge Supporter

    I wrote a short script which is launched via cron every one minute, and restarts Dovecot if necessary.

    Code:
    #!/bin/bash
    
    # nano /etc/crontab
    # run every 1 minute.
    # * * * * * root /home/andrei/scripts/anvcheck_services.sh
    
    NOW=$(date +'%Y-%m-%d %T')
    LOGFILE='/var/log/anvcheck_services.log'
    MAILERRLOG='/var/log/mail.err'
    
    # Create log file if it doesn't exist.
    if [ ! -f $LOGFILE ]; then
        touch $LOGFILE
        echo "$NOW : log file created" >> $LOGFILE
    fi
    
    if [ ! -f $MAILERRLOG ]; then
        exit 0
    fi
    
    # Check Dovecot
    
    ERRSTRING1="dovecot/|lda\|Fatal\|Internal\|error\|occurred"
    
    cat $MAILERRLOG | \
    while read LINE
    do
        echo "$LINE" | grep -q "$ERRSTRING1"
        if [ $? = 0 ]
        then
            echo "$NOW : Dovecot problem detected" >> $LOGFILE
            service dovecot restart
            mv $MAILERRLOG "$MAILERRLOG-$NOW"
            exit 0
        fi
    done
    
     
    till likes this.

Share This Page