[asterisk-commits] wdoekes: branch 1.8 r424875 - in /branches/1.8: channels/ contrib/scripts/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 9 02:59:19 CDT 2014


Author: wdoekes
Date: Thu Oct  9 02:59:11 2014
New Revision: 424875

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=424875
Log:
safe_asterisk: Don't automatically exceed MAXFILES value of 2^20.

On systems with lots of RAM (e.g. 24GB) /proc/sys/fs/file-max divided
by two can exceed the per-process file limit of 2^20. This patch
ensures the value is capped.

(Patch cleaned up by me.)

ASTERISK-24011 #close
Reported by: Michael Myles
Patches:
  safe_asterisk-ulimit.diff uploaded by Michael Myles (License #6626)

Modified:
    branches/1.8/channels/chan_sip.c
    branches/1.8/contrib/scripts/safe_asterisk

Modified: branches/1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_sip.c?view=diff&rev=424875&r1=424874&r2=424875
==============================================================================
--- branches/1.8/channels/chan_sip.c (original)
+++ branches/1.8/channels/chan_sip.c Thu Oct  9 02:59:11 2014
@@ -24737,6 +24737,10 @@
 	} else {
 		transmit_response(p, "200 OK", req);
 	}
+	
+	/* Destroy any pending invites so we won't try to do another
+	 * scheduled reINVITE. */
+	AST_SCHED_DEL_UNREF(sched, p->waitid, dialog_unref(p, "decrement refcount from sip_destroy because waitid won't be scheduled"));
 
 	return 1;
 }

Modified: branches/1.8/contrib/scripts/safe_asterisk
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/contrib/scripts/safe_asterisk?view=diff&rev=424875&r1=424874&r2=424875
==============================================================================
--- branches/1.8/contrib/scripts/safe_asterisk (original)
+++ branches/1.8/contrib/scripts/safe_asterisk Thu Oct  9 02:59:11 2014
@@ -63,12 +63,17 @@
 	message "safe_asterisk was started by `id -n` (uid `id -u`)."
 else
 	if `uname -s | grep Linux >/dev/null 2>&1`; then
-		# maximum number of open files is set to the system maximum divided by two if
-		# MAXFILES is not set.
+		# maximum number of open files is set to the system maximum
+		# divided by two if MAXFILES is not set.
 		if test -z "$MAXFILES"; then
 			# just check if file-max is readable
 			if test -r /proc/sys/fs/file-max; then
-				MAXFILES=$(( `cat /proc/sys/fs/file-max` / 2 ))
+				MAXFILES=$((`cat /proc/sys/fs/file-max` / 2))
+				# don't exceed upper limit of 2^20 for open
+				# files on systems where file-max is > 2^21
+				if test $MAXFILES -gt 1048576; then
+					MAXFILES=1048576
+				fi
 			fi
 		fi
 		SYSCTL_MAXFILES="fs.file-max"




More information about the asterisk-commits mailing list