<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">If someone will create a pull request on GitHub I will implement it. <br class=""><div class="">
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><br class="">-<br class="">Jerry Benton<br class=""><a href="http://www.mailborder.com" class="">www.mailborder.com</a><br class="">+1 - 844-436-6245<br class=""><br class=""><br class=""></div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Apr 28, 2017, at 12:54 AM, Paul Scott <<a href="mailto:sales@edenusa.com" class="">sales@edenusa.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">This is exactly what I thought. Every time I restarted MailScanner, it caused this problem and the system had to be restarted.<br class=""><br class="">Sincerely,<br class=""><br class="">Paul Scott, Engineer<br class="">Eden USA, Incorporated<br class="">Event Production Services Since 1995<br class="">Los Angeles-Las Vegas-New York<br class=""><a href="mailto:sales@edenusa.com" class="">sales@edenusa.com</a> OR <a href="mailto:edenusasales@gmail.com" class="">edenusasales@gmail.com</a><br class="">Telephone(s): 866.501.3336 OR 951.505.6967<br class="">Fax: 866.502.3336 <br class=""><br class="">WEBSITE: <a href="https://www.edenusa.com" class="">https://www.edenusa.com</a><br class="">FACEBOOK: <a href="http://www.facebook.com/edenusainc" class="">http://www.facebook.com/edenusainc</a><br class=""><br class="">-----Original Message-----<br class="">From: MailScanner [<a href="mailto:mailscanner-bounces+sales=edenusa.com@lists.mailscanner.info" class="">mailto:mailscanner-bounces+sales=edenusa.com@lists.mailscanner.info</a>] On Behalf Of David While<br class="">Sent: Wednesday, April 26, 2017 9:39 AM<br class="">To: <a href="mailto:mailscanner@lists.mailscanner.info" class="">mailscanner@lists.mailscanner.info</a><br class="">Subject: Race condition on restart<br class=""><br class="">There is a bug in MailScanner which leads to a race condition.<br class=""><br class="">The init script which starts/stops & restarts MailScanner removes the PID file when MailScanner is stopped.<br class=""><br class="">Unfortunately when MailScanner is issued with a SIGTERM (when issuing a restart or stop) then it also removes the PID file (line 1419 in MailScanner).<br class=""><br class="">What is happening is that the init script issues the kill and then continues. This doesn't kill MailScanner but simply sends the signal. <br class="">MailScanner does some processing before dying. Consequently there is now a race as to who will remove the PID file. The worst case is that it is removed after MailScanner has been restarted. This leads to the hourly ms-check constantly restarting MailScanner.<br class=""><br class="">I fixed this in the init script by:<br class=""><br class="">1. Removing the following lines from do_stop<br class=""><br class=""> # remove pid file<br class=""> if [ -f $PIDFILE ] ; then<br class=""> rm -f $PIDFILE<br class=""> fi<br class=""><br class="">2. Moving the following lines from restart to do_stop where the above lines were removed<br class=""><br class=""> s='-\|/';<br class=""> x=0<br class=""> i=0<br class=""> while [ "$x" -lt 300 -a -f $PIDFILE ]; do<br class=""> x=$((x+1));<br class=""> i=$(( (i+1) %4 ));<br class=""> printf "\r${s:$i:1}";<br class=""> sleep .1;<br class=""> done<br class=""><br class="">What this does is wait for MailScanner to die and remove the PID file before continuing.<br class=""><br class="">I don't think this is a permament fix as there ought to be a check that it has not timed out before continuing.<br class=""><br class="">David While<br class=""><br class=""><br class=""><br class="">--<br class="">MailScanner mailing list<br class=""><a href="mailto:mailscanner@lists.mailscanner.info" class="">mailscanner@lists.mailscanner.info</a><br class="">http://lists.mailscanner.info/mailman/listinfo/mailscanner<br class=""><br class=""><br class=""><br class="">-- <br class="">MailScanner mailing list<br class="">mailscanner@lists.mailscanner.info<br class="">http://lists.mailscanner.info/mailman/listinfo/mailscanner<br class=""><br class=""></div></div></blockquote></div><br class=""></body></html>