freeswitch-stable: disable mod_v8 heap snapshot by default

mod_v8 sporadically failed to build due to a segmentation fault when
generating the heap snapshot. This patch adds a switch to FreeSWITCH to
disable the snapshot and a symbol to toggle it.

Default is to not use a heap snapshot.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
This commit is contained in:
Sebastian Kemper 2017-07-16 22:05:54 +02:00
parent 98232d46cb
commit becb9d05e2
3 changed files with 43 additions and 5 deletions

View file

@ -66,6 +66,17 @@ config FS_STABLE_WITH_V8
If you want mod_v8 to become available, select 'y'.
config FS_STABLE_WITH_V8_SNAPSHOT
bool "Include heap snapshot"
depends on FS_STABLE_WITH_V8
default n
help
V8 can be built with a heap snapshot for faster initialization. Default
is 'n' because of seemingly random segmentation faults observed when
generating the snapshot.
Only select 'y' if you know what you are doing.
config FS_STABLE_WITH_VPX
bool "Compile with VPx support"
depends on FS_STABLE_WITH_LIBYUV

View file

@ -253,6 +253,8 @@ PKG_CONFIG_DEPENDS:= \
CONFIG_FS_STABLE_WITH_PGSQL \
CONFIG_FS_STABLE_WITH_PNG \
CONFIG_FS_STABLE_WITH_SRTP \
CONFIG_FS_STABLE_WITH_V8 \
CONFIG_FS_STABLE_WITH_V8_SNAPSHOT \
CONFIG_FS_STABLE_WITH_VPX \
CONFIG_FS_STABLE_WITH_ZRTP \
CONFIG_LIBC \
@ -684,7 +686,8 @@ endif
ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-mod-v8),)
CONFIGURE_ARGS+= \
--enable-static-v8
--enable-static-v8 \
$(if $(CONFIG_FS_STABLE_WITH_V8_SNAPSHOT),,--disable-snapshot-v8)
endif
# Make mod_spandsp use fixed point math when soft float support is

View file

@ -1,6 +1,6 @@
--- a/src/mod/languages/mod_v8/Makefile.am
+++ b/src/mod/languages/mod_v8/Makefile.am
@@ -15,7 +15,7 @@ V8_LIBEXT=dylib
@@ -15,12 +15,17 @@ V8_LIBEXT=dylib
V8_BUILDPARAMS=snapshot=off i18nsupport=off
V8_SNAPSHOT=nosnapshot
else
@ -9,7 +9,17 @@
V8_LIBEXT=so
# Some gcc versions report warnings incorrectly
V8_BUILDPARAMS=strictaliasing=off werror=no i18nsupport=off
@@ -29,8 +29,8 @@ V8_STATIC_DIR=$(V8_BUILDDIR)/out/native
+if DISABLE_SNAPSHOT_V8
+V8_BUILDPARAMS+=snapshot=off
+V8_SNAPSHOT=nosnapshot
+else
V8_SNAPSHOT=snapshot
endif
+endif
if ENABLE_STATIC_V8
# Build the static lib version of V8
@@ -29,8 +34,8 @@ V8_STATIC_DIR=$(V8_BUILDDIR)/out/native
V8_ICU_STATIC_DIR=$(V8_BUILDDIR)/out/native
V8_CXXFLAGS =
else
@ -20,7 +30,7 @@
V8_CXXFLAGS = -fPIC
endif
V8LIB=$(V8_STATIC_DIR)/libv8_base*.a
@@ -46,11 +46,6 @@ else
@@ -46,11 +51,6 @@ else
V8_EXTRA_BUILD_PARAMS=--no-parallel
endif
@ -32,7 +42,7 @@
MODNAME=mod_v8
AM_CFLAGS += -I. -I./include -I$(switch_srcdir)/src/mod/languages/mod_v8/include -I$(V8_DIR)/include
@@ -121,21 +116,13 @@ $(V8_DIR)/.stamp-patch: $(V8_DIR)
@@ -121,21 +121,13 @@ $(V8_DIR)/.stamp-patch: $(V8_DIR)
$(V8LIB): $(V8_DIR) $(V8_DIR)/.stamp-patch
mkdir -p $(V8_BUILDDIR)
@ -61,3 +71,17 @@
if ENABLE_STATIC_V8
install-exec-local: $(V8LIB)
--- a/configure.ac
+++ b/configure.ac
@@ -1519,6 +1519,11 @@ AC_ARG_ENABLE(parallel-build-v8,
[AS_HELP_STRING([--disable-parallel-build-v8], [Disable parallel build of V8])], [enable_parallel_build_v8="$enableval"], [enable_parallel_build_v8="yes"])
AM_CONDITIONAL([ENABLE_PARALLEL_BUILD_V8],[test "x$enable_parallel_build_v8" != "xno"])
+# Option to force heap snapshot generation of Google's V8 to off
+AC_ARG_ENABLE(snapshot-v8,
+[AS_HELP_STRING([--disable-snapshot-v8], [Disable heap snapshot generation of V8])], [enable_snapshot_v8="$enableval"], [enable_snapshot_v8="yes"])
+AM_CONDITIONAL([DISABLE_SNAPSHOT_V8],[test "x$enable_snapshot_v8" != "xyes"])
+
AM_CONDITIONAL([HAVE_ODBC],[test "x$enable_core_odbc_support" != "xno"])
AM_CONDITIONAL([HAVE_MYSQL],[test "$found_mysql" = "yes"])