You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by me...@apache.org on 2020/06/10 03:33:00 UTC

[incubator-apisix] branch master updated: change: disable reuseport in development mode, it more easy to manage worker process. (#1175)

This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 9b47b31  change: disable reuseport in development mode, it more easy to manage worker process. (#1175)
9b47b31 is described below

commit 9b47b31c50682899427fe647b1392c74ce754006
Author: YuanSheng Wang <me...@gmail.com>
AuthorDate: Wed Jun 10 11:32:52 2020 +0800

    change: disable reuseport in development mode, it more easy to manage worker process. (#1175)
---
 .travis/apisix_cli_test.sh | 21 +++++++++++++++++++++
 bin/apisix                 |  1 +
 2 files changed, 22 insertions(+)

diff --git a/.travis/apisix_cli_test.sh b/.travis/apisix_cli_test.sh
index ba94fb2..ca31995 100755
--- a/.travis/apisix_cli_test.sh
+++ b/.travis/apisix_cli_test.sh
@@ -23,6 +23,8 @@
 
 set -ex
 
+git checkout conf/config.yaml
+
 # check whether the 'reuseport' is in nginx.conf .
 make init
 
@@ -73,6 +75,25 @@ done
 sed -i '/dns_resolver:/,+4s/^#//'  conf/config.yaml
 echo "passed: system nameserver imported"
 
+# enable enable_dev_mode
+sed  -i 's/enable_dev_mode: false/enable_dev_mode: true/g'  conf/config.yaml
+
+make init
+
+count=`grep -c "worker_processes 1;" conf/nginx.conf`
+if [ $count -ne 1 ]; then
+    echo "failed: worker_processes is not 1 when enable enable_dev_mode"
+    exit 1
+fi
+
+count=`grep -c "listen 9080.*reuseport" conf/nginx.conf || true`
+if [ $count -ne 0 ]; then
+    echo "failed: reuseport should be disabled when enable enable_dev_mode"
+    exit 1
+fi
+
+git checkout conf/config.yaml
+
 # check whether the 'worker_cpu_affinity' is in nginx.conf .
 
 make init
diff --git a/bin/apisix b/bin/apisix
index 7e6658a..79c00ed 100755
--- a/bin/apisix
+++ b/bin/apisix
@@ -714,6 +714,7 @@ local function init()
 
     if(sys_conf["enable_dev_mode"] == true) then
         sys_conf["worker_processes"] = 1
+        sys_conf["enable_reuseport"] = false
     else
         sys_conf["worker_processes"] = "auto"
     end