freeswitch-stable: disable mod_v8 heap snapshot by default
authorSebastian Kemper <sebastian_ml@gmx.net>
Sun, 16 Jul 2017 20:05:54 +0000 (22:05 +0200)
committerSebastian Kemper <sebastian_ml@gmx.net>
Sun, 16 Jul 2017 20:05:56 +0000 (22:05 +0200)
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>
net/freeswitch-stable/Config.in
net/freeswitch-stable/Makefile
net/freeswitch-stable/patches/240-mod_v8.patch

index 556de49e476db5d2ce169ede224369e2c974ac4f..b88c55a418bad88c2d11e07c20b4806bebd3b18f 100644 (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
index 594fba77dbaa712bdd412a915c64fc9a1b367dca..1879590e61c42a483c83665feb08a30f665092a6 100644 (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
index c438bdbf0d918ea67ac518c4964b25c8d51ca054..21e3dc9b1060f1f77720e58486b9c5a166bf41f1 100644 (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)
  
  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"])