Could not send mail cannot allocate memory

Hello,

We’ve been using RT 5 for some time without issues. Today I noticed that one user had replied to a ticket and the ticket got updated but it didn’t trigger a notification email for us (therefore the ticket was sitting there as we supposed there was no update).

I then replied to the user and RT refused to send out the mail message again. I noticed that in the ticket thread the failures were marked as:

“The RT System itself - Sending the previous mail has failed. Please contact your admin, they can find more details in the logs.”

This is what I found in the logs:

Sep 17 10:08:27 helpdesk RT: [6585] rt-5.0.0-6585-1600441705-1738.113-5-0@example.com: Could not send mail with command /usr/sbin/sendmail -oi -t: open2: fork failed: Cannot allocate memory at /home/rtuser/rt5/sbin/…/lib/RT/Interface/Email.pm line 937.

Any ideas?

I think this is exactly what the error message says, the server ran out of memory and couldn’t send the email.

Its good to check how much memory a server has from time to time. Maybe you have a process running thats eating a lot of mem?

Hi knation,

I get that. But maybe I didn’t ask correctly. Since I am having oom issues has anyone got a suggestion to tweak RT 5? We’re currently running on a VM with:

  • Ubuntu 18.04
  • 2 vCPU
  • 3 GB RAM

I mean, this should be enough to run RT5 in theory but still getting the out of memory issues.

Thx

That should definitely be enough to run RT, I suspect something else is going on on this machine that’s chewing up RAM. Check top (sort output by memory use) and see which process is being a pig. If you’re running your RT database on the same box & the DB server is holding on to a lot of RAM that could be part of your problem.

Also check that you have “adequate” swap space to deal with RAM demand spikes. As a personal rule I like to have at least 2GB of swap no matter how much RAM I have in a box, but I’ve seen some Ubuntu machines configured with NO swap space, and that’s… uh… “Not Good” IMHO. (With 3GB of RAM you’ll almost certainly hit swap occasionally if just for kicking out unused chunks of the web server code so other stuff can use the RAM. If the DB is on the same box it’s almost guaranteed necessary).

Hi,
we are currently facing the same issue. Upon checking there is enough memory available on the server. I suspect the GPG module to be misbehaving as the errors start to happen after RT tries to verify some GPG signatures of incoming mails.
For example
Apr 7 14:01:02 yyyy d70d95a0139c: gpg: BAD signature from "xxxx <xxxx@xxxx at>" [undefined] (/opt/rt5/sbin/../lib/RT/Crypt/GnuPG.pm:407)

Right after this, mailing fails until we restart rt:

Apr  7 14:03:01 yyyyyy a3bce41aaf81: [7] [Thu Apr  7 12:03:01 2022] [critical]: <rt-5.0.2-7-1649332981-462.362065-2-0@XXXXXX>: Could not send mail with command `/usr/bin/msmtp -oi -t`: open2: fork failed: Cannot allocate memory at /opt/rt5/sbin/../lib/RT/Interface/Email.pm line 940.
Apr  7 14:03:01 yyyyyy a3bce41aaf81:
Apr  7 14:03:01 yyyyyy a3bce41aaf81: Stack:
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/usr/local/lib/perl5/5.34.1/Carp.pm:291]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/usr/local/lib/perl5/5.34.1/IPC/Open3.pm:254]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/usr/local/lib/perl5/5.34.1/IPC/Open2.pm:121]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Interface/Email.pm:940]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Action/SendEmail.pm:300]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Action/SendEmail.pm:115]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/ScripAction.pm:201]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Scrip.pm:665]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Scrips.pm:297]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Transaction.pm:213]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Record.pm:1686]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Ticket.pm:2847]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Group.pm:1033]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Ticket.pm:2166]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Ticket.pm:1791]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Ticket.pm:2179]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [(eval 24436):44]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/ScripAction.pm:201]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Scrip.pm:665]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Scrips.pm:297]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Transaction.pm:213]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Record.pm:1686]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Ticket.pm:568]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Interface/Email/Action/Defaults.pm:106]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Interface/Email/Action/Defaults.pm:135]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Interface/Email/Action/Defaults.pm:117]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Interface/Email.pm:428]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/sbin/../lib/RT/Interface/Email.pm:257]
Apr  7 14:03:01 yyyyyy a3bce41aaf81:  [/opt/rt5/share/html/REST/1.0/NoAuth/mail-gateway:61] (/opt/rt5/sbin/../lib/RT/Interface/Email.pm:957)