Sendmail memory allocation

Has anyone ever come across the following error? It seemed to have
happened randomly, I had to shutdown apache since it was stuck in this
state for sending mails. I’m using apache2 and fastcgi, I’m guessing
something broke once and due to the constant running it affected
everything else. I doubt there’s anything that can be done just curious
if others have seen.

[crit]: rt-3.8.1-*@domain.com: Could not send mail with command
/usr/sbin/sendmail -oi -t: couldn’t e
xecute program: Cannot allocate memory at
/var/opt/rt3/bin/…/lib/RT/Interface/Email.pm line 405.

Hey Curtis

I have been pulling my hair out over this for some time now.

It is triggered when sending a large email (over some threshold size, around
2MB in my case) and then persists until the next restart of apache (apache2
in my case). It is a pretty silent failure, although you will see in the RT
ticket display that the usual “Outgoing email recorded” log is missing.

I did manage to fix it for most cases, but I can’t remember how. I’m hoping
I doumented it somewhere and can give you some tips if I find where.
However, I have just had a new instance of the problem with an 11MB email
(which is why I am digging around today). So it looks like my solution
didn’t fix the problem, it simply increased the threshold.

I will reply shortly with whatever I can find.

RichardOn Wed, Jan 7, 2009 at 6:10 PM, Curtis Bruneau curtisb@vianet.ca wrote:

Has anyone ever come across the following error? It seemed to have
happened randomly, I had to shutdown apache since it was stuck in this
state for sending mails. I’m using apache2 and fastcgi, I’m guessing
something broke once and due to the constant running it affected
everything else. I doubt there’s anything that can be done just curious
if others have seen.

[crit]: rt-3.8.1-*@domain.com: Could not send mail with command
/usr/sbin/sendmail -oi -t: couldn’t e
xecute program: Cannot allocate memory at
/var/opt/rt3/bin/…/lib/RT/Interface/Email.pm line 405.


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Ok, I did send an email with my solution. The thread subject was:

[rt-users] RT stopped sending mail / No recipients found. Not sending.

There are a few solution discussed (it dates back to 2007). But my response
was:

Hi folks

I have recently experienced this same problem too, and would like to comment
on what I did as a workaround. To recap on the problem:

Outgoing email is not sent by RT, and " Outgoing email recorded " does not
appear on the ticket. Restarting Apache resolves this temporarily. It is
definitely related to sending large messages. To reproduce, I simply send an
email via RT with a large attachment (4MB) and RT will stop sending mail
until the next restart of Apache. The Apache error log shows it is unable to
allocate sufficient memory to launch sendmail:

“Couldn’t run /usr/sbin/sendmail: Cannot allocate memory at
/usr/share/request-tracker3.6/lib/RT/Action/SendEmail.pm line 320.”

In my case I am using exim4, so sendmail is just a symlink to that.

Alexander found a workaround for himself below, and I would like to add to
this conversation what I did to fix it.

I run Apache/2.2.8 (Ubuntu 8.04) mod_perl/2.0.3 Perl/v5.8.8 and Exim 4.69. I
seem to have found a workaround for this by replacing the Apache "worker"
MPM (mutli-processing module) with the older “prefork” MPM. On Ubuntu 8.04
this can be done by issuing “apt-get install apache2-mpm-prefork”. The
difference is that worker uses threads whereas prefork only uses processes
for concurrency. This is obviously not ideal, as you want RT to work with
any of the Apache MPMs.

Then I realised that while I am using Exim4, RT is configured to use
"sendmailpipe", so a more correct solution (than reconfiguring apache) might
be to change this setting to just “sendmail”, under the assumtion that the
"sendmailpipe" version is not compatible with other MTAs such as Exim.
Interestingly, this change does fix the issue. But unfortunately Exim sets
the envelope sender of the email to the local user (www-data@f.q.d.n)
instead of the desired email address (which is in thre From: header of the
mail). In some mail clients this results in sender listed as:

www-data [www-data@f.q.d.n]; on behalf of; Richard Brady [
support@example.com].

To get around this, RT needs to pass an envelope sender in the arguments to
senfdmail (exim4), which is currently not done in SendEmail.pm.

So I have gone with installing apache2-mpm-prefork as my workaround.

Hopes this helps.

RichardOn Wed, Jan 28, 2009 at 11:24 AM, Richard Brady rnbrady@gmail.com wrote:

Hey Curtis

I have been pulling my hair out over this for some time now.

It is triggered when sending a large email (over some threshold size,
around 2MB in my case) and then persists until the next restart of apache
(apache2 in my case). It is a pretty silent failure, although you will see
in the RT ticket display that the usual “Outgoing email recorded” log is
missing.

I did manage to fix it for most cases, but I can’t remember how. I’m hoping
I doumented it somewhere and can give you some tips if I find where.
However, I have just had a new instance of the problem with an 11MB email
(which is why I am digging around today). So it looks like my solution
didn’t fix the problem, it simply increased the threshold.

I will reply shortly with whatever I can find.

Richard

On Wed, Jan 7, 2009 at 6:10 PM, Curtis Bruneau curtisb@vianet.ca wrote:

Has anyone ever come across the following error? It seemed to have
happened randomly, I had to shutdown apache since it was stuck in this
state for sending mails. I’m using apache2 and fastcgi, I’m guessing
something broke once and due to the constant running it affected
everything else. I doubt there’s anything that can be done just curious
if others have seen.

[crit]: rt-3.8.1-*@domain.com: Could not send mail with command
/usr/sbin/sendmail -oi -t: couldn’t e
xecute program: Cannot allocate memory at
/var/opt/rt3/bin/…/lib/RT/Interface/Email.pm line 405.


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com