postfix - cannot allocate memory

LonelyStar

New Member
Hallo Zusammen,

Ich bin dabei postfix auf meinem vServer zu konfigurieren.
Ich habe mich dabei an dieses howto gehalten:

HowTo/DovecotLDAPostfixAdminMySQL - Dovecot Wiki

Ich habe also ein System mit Dovecot+Postfix+Mysql

Jetzt bekomme ich sollche Meldungen in meiner mail.info:
Code:
Jan 13 12:10:29 ********** postfix/master[14015]: warning: /usr/lib/postfix/bounce: bad command startup -- throttling
Und solche:
Code:
Jan 13 12:10:28 ********** postfix/bounce[20392]: fatal: inet_addr_local[getifaddrs]: getifaddrs: Cannot allocate memory

Wobei die Prozesse immer andere sind.

free sagt folgendes:
Code:
             total       used       free     shared    buffers     cached
Mem:        307200     130128     177072          0          0          0
-/+ buffers/cache:     130128     177072
Swap:            0          0          0

Es sollte also genug memory da sein.

Unter anderem schlagen gelegentlich connects zur mysql database fehl, das sehe ich aber nur in den logs. Wenn ich es per Hand probiere, geht es!

Hier ist eine komplette log, wenn ich probiere mir eine mail zu senden:
Code:
Jan 13 12:10:05 ********** postfix/smtpd[17980]: NOQUEUE: reject_warning: RCPT from localhost.localdomain[127.0.0.1]: 450 4.5.2 <localhost>: Helo command rejected: need fully-qualified hostname; from=<**@**********> to=<[email protected]> proto=ESMTP helo=<localhost>
Jan 13 12:10:05 ********** postfix/smtpd[17980]: NOQUEUE: reject_warning: RCPT from localhost.localdomain[127.0.0.1]: 450 4.7.1 <localhost>: Helo command rejected: Host not found; from=<**@**********> to=<[email protected]> proto=ESMTP helo=<localhost>
Jan 13 12:10:06 ********** postfix/smtpd[17980]: 929B29F22AFA: client=localhost.localdomain[127.0.0.1]
Jan 13 12:10:12 ********** postfix/smtpd[20123]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Jan 13 12:10:12 ********** postfix/smtpd[20123]: warning: SASL: Connect to private/auth failed: Cannot allocate memory
Jan 13 12:10:12 ********** postfix/smtpd[20123]: fatal: no SASL authentication mechanisms
Jan 13 12:10:13 ********** postfix/master[14015]: warning: process /usr/lib/postfix/smtpd pid 20123 exit status 1
Jan 13 12:10:13 ********** postfix/master[14015]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling
Jan 13 12:10:28 ********** postfix/cleanup[20024]: 929B29F22AFA: message-id=<20090113111006.929B29F22AFA@**********.**********.net>
Jan 13 12:10:28 ********** postfix/qmgr[14018]: 929B29F22AFA: from=<**@***********>, size=370, nrcpt=1 (queue active)
Jan 13 12:10:28 ********** dovecot: auth-worker(default): mysql: Connect failed to localhost (mail_users): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (12) - waiting for 1 seconds before retry
Jan 13 12:10:28 ********** dovecot: auth-worker(default): sql([email protected]): User query failed: Not connected to database
Jan 13 12:10:28 ********** postfix/bounce[20392]: fatal: inet_addr_local[getifaddrs]: getifaddrs: Cannot allocate memory
Jan 13 12:10:29 ********** postfix/master[14015]: warning: process /usr/lib/postfix/bounce pid 20392 exit status 1
Jan 13 12:10:29 ********** postfix/master[14015]: warning: /usr/lib/postfix/bounce: bad command startup -- throttling
Jan 13 12:10:29 ********** postfix/smtpd[17980]: disconnect from localhost.localdomain[127.0.0.1]

Hier main postconf -n
Code:
config_directory = /etc/postfix
default_process_limit = 30
disable_vrfy_command = yes
inet_interfaces = all
invalid_hostname_reject_code = 450
maps_rbl_reject_code = 450
mydestination = **********
myhostname = **********
mynetworks = 127.0.0.0/8
myorigin = /etc/mailname
non_fqdn_reject_code = 450
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_data_restrictions = reject_unauth_pipelining,        reject_multi_recipient_bounce,        permit
smtpd_enforce_tls = no
smtpd_helo_required = yes
smtpd_recipient_restrictions = permit_sasl_authenticated        reject_unauth_destination        reject_invalid_helo_hostname        warn_if_reject reject_non_fqdn_helo_hostname        warn_if_reject reject_unknown_helo_hostname        warn_if_reject reject_unknown_client        reject_non_fqdn_sender        reject_non_fqdn_recipient        reject_unknown_sender_domain        reject_unknown_recipient_domain        reject_rbl_client zen.spamhaus.org        reject_rbl_client bl.spamcop.net        reject_rbl_client dnsbl.sorbs.net=127.0.0.2        reject_rbl_client dnsbl.sorbs.net=127.0.0.3        reject_rbl_client dnsbl.sorbs.net=127.0.0.4        reject_rbl_client dnsbl.sorbs.net=127.0.0.5        reject_rbl_client dnsbl.sorbs.net=127.0.0.7        reject_rbl_client dnsbl.sorbs.net=127.0.0.9        reject_rbl_client dnsbl.sorbs.net=127.0.0.11        reject_rbl_client dnsbl.sorbs.net=127.0.0.12        warn_if_reject reject_rhsbl_sender dsn.rfc-ignorant.org        warn_if_reject reject_rhsbl_sender abuse.rfc-ignorant.org        warn_if_reject reject_rhsbl_sender whois.rfc-ignorant.org        warn_if_reject reject_rhsbl_sender bogusmx.rfc-ignorant.org        warn_if_reject reject_rhsbl_sender postmaster.rfc-ignorant.org        permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_loglevel = 1
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
tls_random_source = dev:/dev/urandom
virtual_alias_maps = proxy:mysql:$config_directory/sql/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:8
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = proxy:mysql:$config_directory/sql/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = proxy:mysql:$config_directory/sql/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 113
virtual_transport = dovecot
virtual_uid_maps = static:113

Und meine master.cf:
Code:
#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       -       -       -       smtpd
#submission inet n       -       -       -       -       smtpd
#  -o smtpd_tls_security_level=encrypt
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#smtps     inet  n       -       -       -       -       smtpd
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#628      inet  n       -       -       -       -       qmqpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       -       300     1       oqmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       -       -       -       smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       -       -       -       smtp
	-o smtp_fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
retry     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# See the Postfix UUCP_README file for configuration details.
#
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix	-	n	n	-	2	pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}
dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:mail argv=/usr/lib/dovecot/deliver -d ${recipient}

Wie kann ich rausfinden, warum er probleme mit dem Speicher anfordern hat? Woher kommen diese "Bad command startup" Fehlermeldungen?

Danke!
Nathan
 
Last edited by a moderator:
Hallo!
Was sagt cat /proc/user_beancounters? Eventuell ist auch noch die Ausgabe von vzfree von Interesse.

mfG
Thorsten
 
Stammt der Output von "free" während es zu dem Problem kommt, oder von irgendwann?

Von wann der output ist, weiß ich nicht genau. Ich schaue mir "free" regelmäßig an, habe immer mindestens 40MB frei!

Die Fehler tretten auf jefenfall auch dann auf, wenn ich sehr viel mehr frei habe (so wie bei dem gepostetem output).

as sagt cat /proc/user_beancounters? Eventuell ist auch noch die Ausgabe von vzfree von Interesse

Code:
cat /proc/user_beancounters 
Version: 2.5
       uid  resource           held    maxheld    barrier      limit    failcnt
     9176:  kmemsize        4207202    4215924    8270282    9097310          0
            lockedpages           0          0         79         79        114
            privvmpages       32123      32169      76800      84480         84
            shmpages            654        654      25600      25600          0
            dummy                 0          0 2147483647 2147483647          0
            numproc              38         38        164        164          0
            physpages          8368       8368          0 2147483647          0
            vmguarpages           0          0      76800 2147483647          0
            oomguarpages       8376       8376      76800 2147483647          0
            numtcpsock           13         13        164        164          0
            numflock              5          5        262        288          0
            numpty                1          1         16         16          0
            numsiginfo            0          1        512        512          0
            tcpsndbuf         89440      89440    1137635    1809379          0
            tcprcvbuf        114688     114688    1137635    1809379         10
            othersockbuf     234780     234780     568817    1240561          0
            dgramrcvbuf           0          0     568817     568817          0
            numothersock        141        141        164        164        675
            dcachesize       458253     461970    1209139    1245413          0
            numfile            1583       1583       3008       3008          0
            dummy                 0          0          0          0          0
            dummy                 0          0          0          0          0
            dummy                 0          0          0          0          0
            numiptent            14         14         35         35          0

Das sagt mir nix ...

vzfree ist bei mir nicht installiert, und apt-get install vzfree hilft auch nicht weiter ...
 
Code:
vzfree 
VPS Speichernutzung:
Momentan genutzt:       126.715 MB
Maximal genutzt:        126.715 MB
Zugesichert:            300 MB
Maximal nutzbar:        330 MB
 
Die /proc/user_beancounters zeigen, dass du da ein Speicherproblem hast.
Es ist also wirklich zu wenig speicher vorhanden. Das sagt ja auch schon eine deiner Log-Einträge.

Hast du den Server zwischenzeitlich mal hoch oder runter gefahren. Denn die Ausgabe von vzfree passt nicht ganz dazu.

Versuch doch mal Postfix mit Pherepherie zu starten, und rufe dann noch mal vzfree auf.

Was ist denn noch alles auf dem Server installiert?
 
Hallo,

Habe das Problem halbwegs gelöst, danke für die Hilfe!

Ich habe
default_process_limit=3

gesetzt und einige nicht benutzte services aus der master.cf herausgenommen.

Was unter heavy load passiert, weiß ich nicht.
Postfix braucht immer noch fast 100 sockets. Kann man das irgendwie noch reduzieren?

Danke!
nathan
 
Back
Top