[Freeswitch-users] Sendmail segfaulting

John freeswitch at earthspike.net
Fri Jan 27 04:40:52 MSK 2012


Rob,

sendmail is running as a service, so the segfault could be being thrown
by the sendmail service, not necessarily by the command-line-app-version
that adds mails to the queue (and then terminates).  Most mailers work
this way: separate processes to add the mail to the queue, process the
queue, accept connections on various sockets.  FreeSWITCH is written to
wait until the queue-insertion invocation of sendmail is completed.
Thankfully, it doesn't wait until the message is actually sent on to its
next location as, in some cases, that could take hours if the remote
host is down.  In your log below, it looks like sendmail [25200] has
happily accepted the message from FreeSWITCH and queued it for
delivery.  sendmail [25207] is the process that has then barfed, after
the message has been queued, which suggests that it is nothing to do
with FreeSWITCH itself.  Perhaps there might be a copy of the message
from the crashing process in the message queues in /var/spool/mail (or
similar) which you could look at to see if there is anything weird in
it?  But the bottom line is that it looks like you have  pure sendmail
problem. Unfortunately, that's where my knowledge stops as I run Postfix
as my main mailer and ssmtp as a dumb relay.  Maybe someone on a CentOS
or sendmail list can help you with the sendmail issue?  Or, as I
mentioned earlier, if you don't need a full mailer, you could remove
sendmail and install a simpler mailer such as ssmtp (as I see you have a
relay that needs TLS and for which authentication appears to be failing).

John

PS. The parallel test is to wrap the original command in parentheses and
duplicate it several times on a single command line, each time followed
by an ampersand to put it into the background, ie:

rmorin at blie-fs$ ( cat ....   | sendmail ......  ... ) & ( cat ..... |
sendmail .... ) &    .... and so on

[It maybe that your sendmail queues faster than your shell can invoke
sendmail, so it isn't really in parallel, but then that should be
similar for FreeSWITCH too, so it would be a 'rapid-fire' test instead
of a parallel test.]

On 27/01/12 00:46, Rob Morin wrote:
>
> John,
>
>  
>
> Thank you for your help.
>
>  
>
> I ran the command line as you described, and everything worked fine.
>
>  
>
> I should also mention, that some of my extensions do not have the
> notifications turned on. And even for them, getting the message
> through is hit or miss -- sometimes it segfaults, sometimes it
> doesn't. So I don't necessarily think it's a "two message" issue.
> Also, in looking at the logs, sometimes I see the segfault appear in
> the middle of the maillog logging for the other message. So it doesn't
> look like FS is waiting for the sendmail command to return before
> executing the next command.  Here's what I mean...
>
>  
>
> Jan 26 14:28:50 blie-fs sendmail[25200]: q0QESoi9025200:
> Authentication-Warning: blie-fs.blie-ent.com: freeswitch set sender to
> voicemail at blie-ent.com using -f
>
> Jan 26 14:28:50 blie-fs sendmail[25200]: q0QESoi9025200:
> from=voicemail at blie-ent.com, size=18662, class=0, nrcpts=1,
> msgid=<201201261428.q0QESoi9025200 at blie-fs.blie-ent.com>,
> relay=freeswitch at localhost
>
> Jan 26 14:28:51 blie-fs sendmail[25201]: q0QESpVj025201:
> from=<voicemail at blie-ent.com>, size=19026, class=0, nrcpts=1,
> msgid=<201201261428.q0QESoi9025200 at blie-fs.blie-ent.com>, proto=ESMTP,
> daemon=MTA, relay=localhost [127.0.0.1]
>
> Jan 26 14:28:51 blie-fs sendmail[25200]: q0QESoi9025200:
> to=rmorin at blie-ent.com, ctladdr=voicemail at blie-ent.com (501/501),
> delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=48662,
> relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (q0QESpVj025201
> Message accepted for delivery)
>
> Jan 26 14:28:51 blie-fs kernel: [41082.268638] sendmail[25207]:
> segfault at 7fff96dffed8 rip 7f158ee0b7fb rsp 7fff96dffea0 error 6
>
> Jan 26 14:28:51 blie-fs sendmail[25203]: STARTTLS=client,
> relay=smtp.sendgrid.net., version=TLSv1/SSLv3, verify=FAIL,
> cipher=DHE-RSA-AES256-SHA, bits=256/256
>
> Jan 26 14:28:51 blie-fs sendmail[25203]: q0QESpVj025201:
> to=<rmorin at blie-ent.com>, delay=00:00:00, xdelay=00:00:00,
> mailer=relay, pri=139026, relay=smtp.sendgrid.net. [174.36.32.204],
> dsn=2.0.0, stat=Sent (Delivery in progress)
>
>  
>
> On this instance, the notification didn't get through, but the message
> did.
>
>  
>
> All of that said, I'm not sure how to run the 'parallel' test, though.
> (I did run the single test many times in quick succession with no
> failures.)
>
>  
>
> My ulimit --s is set at 8192. And I don't have any other arguments,
> other than '-t'.
>
>  
>
> Thank you,
>
> Rob
>
>  
>
> *From:*John [mailto:freeswitch at earthspike.net]
> *Sent:* Thursday, January 26, 2012 6:23 PM
> *To:* FreeSWITCH Users Help
> *Subject:* Re: [Freeswitch-users] Sendmail segfaulting
>
>  
>
> Rob,
>
> ssmtp sends whatever it's given:  FreeSWITCH puts the message together
> (in src/switch_utils.c:switch_simple_email()) to make a fully
> MIME-compliant message with the attachments read out of their files
> and then pipes it into the 'sendmail' (whether ssmtp, nullmailer,
> sendemail.py or whatever) program for it to send/relay it.  FreeSWITCH
> waits for the 'cat | sendmail' program to return before continuing
> execution and deleting files, so file deletion is unlikely to be the
> issue.  Like you say, it sounds like the problem is not with
> configuration but it's also very unlikely to be with file deletion. 
>
> Can you reproduce the fault by running sendmail from the command line
> with a suitably formatted mail message[*] as input?  This is pretty
> much what FreeSWITCH does:
>
> cat message.txt | <sendmail.app> -f noreply at mydomain.com
> <mailto:noreply at mydomain.com> <mailer-args> recipient at mydomain.com
> <mailto:recipient at mydomain.com>
>
> ... with <..> from what you have in conf/autoload_configs/switch.conf.xml?
>
> [* 'suitably formatted message' could be one of the successful ones,
> view source, then edit to trim off the transport headers]
>
> If that is successful, try to replicate your 2-message-scenario by
> running two of the above commands in parallel with different input
> files and see if that generates a segfault.  [If you are a linux noob
> as well as a FS noob I can spell this out for you.]
>
> John
>
> On 26/01/12 22:04, Rob Morin wrote:
>
> John,
>
>  
>
> That's helpful, but ssmtp doesn't support attachments so it won't
> support sending the voicemail files.
>
>  
>
> Additionally, I'm somewhat stumped on the default 'sendmail' option.
> The references in the Wiki are basically all 'configuration' issues --
> stack size, etc. The problem I have is that it isn't a configuration
> issue -- sometimes it goes through, sometimes it doesn't. If it were a
> configuration issue, it would never go through (unless it was a
> resource that was near its margin).  So that's why I wanted to insert
> a delay. It appears to me that the segfault is being caused by the
> file getting moved, deleted, or still being open when sendmail
> attempts to access it.  I wish I had more to go on though.
>
>  
>
> Thank you,
>
> Rob
>
>  
>
> *From:*John [mailto:freeswitch at earthspike.net]
> *Sent:* Thursday, January 26, 2012 1:49 PM
> *To:* freeswitch-users at lists.freeswitch.org
> <mailto:freeswitch-users at lists.freeswitch.org>
> *Subject:* Re: [Freeswitch-users] Sendmail segfaulting
>
>  
>
> Slightly unrelated, but I have been using the python script
> sendemail.py until recently when a user noticed that they were not
> being emailed some voicemails.  I have since changed to using ssmtp
> (rather than nullmailer as my mail server requires a login, TLS on
> tcp/587). One thing I noticed, and it may be me that caused it, but
> the sendemail.py script had some indentation using (4) spaces and some
> using tabs.  But the main problem is that the script keeps warning
> about the MimeWriter class being deprecated and has no error reporting
> or recovery, it seems.  For me, it was easier to install ssmtp than
> rewrite the python script.  If you don't need a full mail server, I
> would recommend using a null mailer like ssmtp or nullmailer.
>
> John
>
> On 26/01/12 15:13, Rob Morin wrote:
>
> I tried to modify the eximcompat.sh script to work with sendmail. I'm
> not sure why it didn't work. It might be that, for starters, I don't
> have exim installed, I have sendmail.
>
>  
>
> I haven't tried the python script.  Is that the one you use?
>
>  
>
> Rob
>
>  
>
> *From:*Michael Jerris [mailto:mike at jerris.com]
> *Sent:* Thursday, January 26, 2012 8:09 AM
> *To:* FreeSWITCH Users Help
> *Subject:* Re: [Freeswitch-users] Sendmail segfaulting
>
>  
>
> delay won't help you.  Why didn't the script work?  I know we do this
> and it works fine.  Pretty sure we use a modified version of the
> sample in tree.
>
>  
>
> Mike
>
>  
>
> On Jan 25, 2012, at 10:43 PM, Rob Morin wrote:
>
>
>
>
>
> I saw that, and tried everything I could. Still no luck.
>
>  
>
> My stack limit is 8192, so that shouldn't be the issue.  I'm running
> CentOS x_64.
>
>  
>
> I tried creating a script as the wiki suggests, so that I could make
> changes without having to restart FS. But that didn't work either (I'm
> still a noob). My goal was to add a sleep delay, in the case that FS
> is calling the sendmail command before it's completely written and
> released the email it's sending. Any idea how to make that work?
>
> Thank you,
>
> Rob
>
>  
>
> *From:* Michael Jerris [mailto:mike at jerris.com]
> <mailto:[mailto:mike at jerris.com]> 
> *Sent:* Wednesday, January 25, 2012 1:57 PM
> *To:* FreeSWITCH Users Help
> *Subject:* Re: [Freeswitch-users] Sendmail segfaulting before second
> message is sent
>
>  
>
> http://wiki.freeswitch.org/wiki/Mod_voicemail#Exim4_settings
>
>  
>
> On Jan 25, 2012, at 1:31 PM, Rob Morin wrote:
>
>
>
>
>
>
> For some extensions, I've got FreeSWITCH configured to send both the
> voicemail to an email address and a notification to a cell phone that
> there is a message.
>
>  
>
> Sendmail is segfaulting (error 6) before the second email message is
> sent. Sometimes the notification message is going out, sometimes the
> email message goes.
>
>  
>
> If I am just sending an email, it is **generally** successful.
> Although sometimes it fails, so I really need to fix this.
>
>  
>
> Does anyone have any suggestions as to how I can troubleshoot this? 
>
> (Running CentOS 5.7, sendmail 8.13).
>
>  
>
>
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org <mailto:consulting at freeswitch.org>
> http://www.freeswitchsolutions.com
>  
> 
> 
>  
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>  
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org <mailto:FreeSWITCH-users at lists.freeswitch.org>
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>  
>
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org <mailto:consulting at freeswitch.org>
> http://www.freeswitchsolutions.com
>  
> 
> 
>  
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>  
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org <mailto:FreeSWITCH-users at lists.freeswitch.org>
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>  
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120127/84397df5/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list