You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2021/10/25 02:19:33 UTC

[apisix] branch release/2.10 updated: feat: release 2.10.1 (#5310)

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

spacewander pushed a commit to branch release/2.10
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/release/2.10 by this push:
     new ea6db48  feat: release 2.10.1 (#5310)
ea6db48 is described below

commit ea6db4840a07dcf2e3b595c58c6e2952372c1e7a
Author: 罗泽轩 <sp...@gmail.com>
AuthorDate: Mon Oct 25 10:19:25 2021 +0800

    feat: release 2.10.1 (#5310)
    
    Co-authored-by: 罗泽轩 <sp...@gmail.com>
    Co-authored-by: zdzh <yz...@yzh.com>
    Co-authored-by: jack.fu <ja...@yijinin.com>
    Co-authored-by: leslie <59...@users.noreply.github.com>
    Co-authored-by: tzssangglass <tz...@gmail.com>
    Co-authored-by: oliver <do...@gmail.com>
    Co-authored-by: zdzh <yz...@126.com>
    Co-authored-by: jackfu <ja...@gmail.com>
---
 CHANGELOG.md                                       |  13 +++
 apisix/core/version.lua                            |   2 +-
 apisix/plugin.lua                                  |  17 ++-
 apisix/plugins/ext-plugin/init.lua                 |   1 +
 apisix/plugins/prometheus/exporter.lua             |  15 ++-
 apisix/plugins/zipkin.lua                          |   5 +-
 apisix/upstream.lua                                |   6 +-
 docs/en/latest/config.json                         |   2 +-
 docs/en/latest/how-to-build.md                     |  14 +--
 docs/zh/latest/CHANGELOG.md                        |  13 +++
 docs/zh/latest/config.json                         |   2 +-
 docs/zh/latest/how-to-build.md                     |  14 +--
 ...-master-0.rockspec => apisix-2.10.1-0.rockspec} |   6 +-
 rockspec/apisix-master-0.rockspec                  |   2 +-
 t/cli/test_admin.sh                                |  21 ++++
 t/lib/server.lua                                   |   1 +
 t/node/healthcheck2.t                              | 129 +++++++++++++++++++++
 t/node/priority-balancer/sanity.t                  |   4 +-
 t/node/timeout-upstream.t                          |  67 +++++++++++
 t/plugin/zipkin2.t                                 |  25 ++++
 20 files changed, 324 insertions(+), 35 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3cb40fc..790a4b1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,7 @@ title: Changelog
 
 ## Table of Contents
 
+- [2.10.1](#2101)
 - [2.10.0](#2100)
 - [2.9.0](#290)
 - [2.8.0](#280)
@@ -46,6 +47,18 @@ title: Changelog
 - [0.7.0](#070)
 - [0.6.0](#060)
 
+## 2.10.1
+
+### Bugfix
+
+- fix(zipkin): response_span doesn't have correct start time [#5295](https://github.com/apache/apisix/pull/5295)
+- fix(ext-plugin): don't use stale key [#5309](https://github.com/apache/apisix/pull/5309)
+- fix: route's timeout should not be overwrittern by service [#5219](https://github.com/apache/apisix/pull/5219)
+- fix: filter nil plugin conf triggered by etcd dir init [#5204](https://github.com/apache/apisix/pull/5204)
+- fix: pass correct host header to health checker target nodes [#5175](https://github.com/apache/apisix/pull/5175)
+- fix: upgrade lua-resty-balancer to 0.04 [#5144](https://github.com/apache/apisix/pull/5144)
+- fix(prometheus): avoid negative latency caused by inconsistent Nginx metrics [#5150](https://github.com/apache/apisix/pull/5150)
+
 ## 2.10.0
 
 ### Change
diff --git a/apisix/core/version.lua b/apisix/core/version.lua
index 6217100..350f101 100644
--- a/apisix/core/version.lua
+++ b/apisix/core/version.lua
@@ -15,5 +15,5 @@
 -- limitations under the License.
 --
 return {
-    VERSION = "2.10.0"
+    VERSION = "2.10.1"
 }
diff --git a/apisix/plugin.lua b/apisix/plugin.lua
index dbcce7f..1e060cd 100644
--- a/apisix/plugin.lua
+++ b/apisix/plugin.lua
@@ -244,11 +244,14 @@ function _M.load(config)
         http_plugin_names = {}
         stream_plugin_names = {}
         local plugins_conf = config.value
-        for _, conf in ipairs(plugins_conf) do
-            if conf.stream then
-                core.table.insert(stream_plugin_names, conf.name)
-            else
-                core.table.insert(http_plugin_names, conf.name)
+        -- plugins_conf can be nil when another instance writes into etcd key "/apisix/plugins/"
+        if plugins_conf then
+            for _, conf in ipairs(plugins_conf) do
+                if conf.stream then
+                    core.table.insert(stream_plugin_names, conf.name)
+                else
+                    core.table.insert(http_plugin_names, conf.name)
+                end
             end
         end
     end
@@ -409,6 +412,10 @@ local function merge_service_route(service_conf, route_conf)
         new_conf.value.script = route_conf.value.script
     end
 
+    if route_conf.value.timeout then
+        new_conf.value.timeout = route_conf.value.timeout
+    end
+
     if route_conf.value.name then
         new_conf.value.name = route_conf.value.name
     else
diff --git a/apisix/plugins/ext-plugin/init.lua b/apisix/plugins/ext-plugin/init.lua
index 6cb593c..0e1ec2a 100644
--- a/apisix/plugins/ext-plugin/init.lua
+++ b/apisix/plugins/ext-plugin/init.lua
@@ -65,6 +65,7 @@ local type = type
 local events_list
 local lrucache = core.lrucache.new({
     type = "plugin",
+    invalid_stale = true,
     ttl = helper.get_conf_token_cache_time(),
 })
 
diff --git a/apisix/plugins/prometheus/exporter.lua b/apisix/plugins/prometheus/exporter.lua
index ea1c484..b2c1ebc 100644
--- a/apisix/plugins/prometheus/exporter.lua
+++ b/apisix/plugins/prometheus/exporter.lua
@@ -153,6 +153,14 @@ function _M.log(conf, ctx)
         metrics.latency:observe(upstream_latency,
             gen_arr("upstream", route_id, service_id, consumer_name, balancer_ip))
         apisix_latency =  apisix_latency - upstream_latency
+
+        -- The latency might be negative, as Nginx uses different time measurements in
+        -- different metrics.
+        -- See https://github.com/apache/apisix/issues/5146#issuecomment-928919399
+        if apisix_latency < 0 then
+            apisix_latency = 0
+        end
+
     end
     metrics.latency:observe(apisix_latency,
         gen_arr("apisix", route_id, service_id, consumer_name, balancer_ip))
@@ -165,9 +173,10 @@ function _M.log(conf, ctx)
 end
 
 
-    local ngx_status_items = {"active", "accepted", "handled", "total",
-                             "reading", "writing", "waiting"}
-    local label_values = {}
+local ngx_status_items = {"active", "accepted", "handled", "total",
+                         "reading", "writing", "waiting"}
+local label_values = {}
+
 local function nginx_status()
     local res = ngx_capture("/apisix/nginx_status")
     if not res or res.status ~= 200 then
diff --git a/apisix/plugins/zipkin.lua b/apisix/plugins/zipkin.lua
index cb261c6..8c6deb1 100644
--- a/apisix/plugins/zipkin.lua
+++ b/apisix/plugins/zipkin.lua
@@ -240,15 +240,14 @@ function _M.header_filter(conf, ctx)
     local end_time = opentracing.tracer:time()
 
     if conf.span_version == ZIPKIN_SPAN_VER_1 then
-        ctx.HEADER_FILTER_END_TIME = end_time
         if  opentracing.proxy_span then
             opentracing.body_filter_span = opentracing.proxy_span:start_child_span(
-                "apisix.body_filter", ctx.HEADER_FILTER_END_TIME)
+                "apisix.body_filter", end_time)
         end
     else
         opentracing.proxy_span:finish(end_time)
         opentracing.response_span = opentracing.request_span:start_child_span(
-            "apisix.response_span", ctx.HEADER_FILTER_END_TIME)
+            "apisix.response_span", end_time)
     end
 end
 
diff --git a/apisix/upstream.lua b/apisix/upstream.lua
index 5be6d64..8c4919a 100644
--- a/apisix/upstream.lua
+++ b/apisix/upstream.lua
@@ -111,8 +111,12 @@ local function create_checker(upstream)
 
     local host = upstream.checks and upstream.checks.active and upstream.checks.active.host
     local port = upstream.checks and upstream.checks.active and upstream.checks.active.port
+    local up_hdr = upstream.pass_host == "rewrite" and upstream.upstream_host
+    local use_node_hdr = upstream.pass_host == "node"
     for _, node in ipairs(upstream.nodes) do
-        local ok, err = checker:add_target(node.host, port or node.port, host)
+        local host_hdr = up_hdr or (use_node_hdr and node.domain)
+        local ok, err = checker:add_target(node.host, port or node.port, host,
+                                           true, host_hdr)
         if not ok then
             core.log.error("failed to add new health check target: ", node.host, ":",
                     port or node.port, " err: ", err)
diff --git a/docs/en/latest/config.json b/docs/en/latest/config.json
index 33cf914..f813028 100644
--- a/docs/en/latest/config.json
+++ b/docs/en/latest/config.json
@@ -1,5 +1,5 @@
 {
-  "version": "2.10.0",
+  "version": "2.10.1",
   "sidebar": [
     {
       "type": "category",
diff --git a/docs/en/latest/how-to-build.md b/docs/en/latest/how-to-build.md
index 3598e64..d3de817 100644
--- a/docs/en/latest/how-to-build.md
+++ b/docs/en/latest/how-to-build.md
@@ -36,7 +36,7 @@ You can install Apache APISIX via RPM package, Docker, Helm Chart, and source re
 This installation method is suitable for CentOS 7, please run the following command to install Apache APISIX.
 
 ```shell
-sudo yum install -y https://github.com/apache/apisix/releases/download/2.10.0/apisix-2.10.0-0.el7.x86_64.rpm
+sudo yum install -y https://github.com/apache/apisix/releases/download/2.10.1/apisix-2.10.1-0.el7.x86_64.rpm
 ```
 
 ### Installation via Docker
@@ -49,16 +49,16 @@ Please refer to: [Installing Apache APISIX with Helm Chart](https://github.com/a
 
 ### Installation via Source Release Package
 
-1. Create a directory named `apisix-2.10.0`.
+1. Create a directory named `apisix-2.10.1`.
 
   ```shell
-  mkdir apisix-2.10.0
+  mkdir apisix-2.10.1
   ```
 
 2. Download Apache APISIX Release source package.
 
   ```shell
-  wget https://downloads.apache.org/apisix/2.10.0/apache-apisix-2.10.0-src.tgz
+  wget https://downloads.apache.org/apisix/2.10.1/apache-apisix-2.10.1-src.tgz
   ```
 
   You can also download the Apache APISIX Release source package from the Apache APISIX website. The [Apache APISIX Official Website - Download Page](https://apisix.apache.org/downloads/) also provides source packages for Apache APISIX, APISIX Dashboard and APISIX Ingress Controller.
@@ -66,14 +66,14 @@ Please refer to: [Installing Apache APISIX with Helm Chart](https://github.com/a
 3. Unzip the Apache APISIX Release source package.
 
   ```shell
-  tar zxvf apache-apisix-2.10.0-src.tgz -C apisix-2.10.0
+  tar zxvf apache-apisix-2.10.1-src.tgz -C apisix-2.10.1
   ```
 
 4. Install the runtime dependent Lua libraries.
 
   ```shell
-  # Switch to the apisix-2.10.0 directory
-  cd apisix-2.10.0
+  # Switch to the apisix-2.10.1 directory
+  cd apisix-2.10.1
   # Create dependencies
   make deps
   ```
diff --git a/docs/zh/latest/CHANGELOG.md b/docs/zh/latest/CHANGELOG.md
index 8546b34..4d683c8 100644
--- a/docs/zh/latest/CHANGELOG.md
+++ b/docs/zh/latest/CHANGELOG.md
@@ -23,6 +23,7 @@ title: CHANGELOG
 
 ## Table of Contents
 
+- [2.10.1](#2101)
 - [2.10.0](#2100)
 - [2.9.0](#290)
 - [2.8.0](#280)
@@ -46,6 +47,18 @@ title: CHANGELOG
 - [0.7.0](#070)
 - [0.6.0](#060)
 
+## 2.10.1
+
+### Bugfix
+
+- 更正 zipkin 插件 response_span 的开始时间 [#5295](https://github.com/apache/apisix/pull/5295)
+- 避免发送过期 key 给 plugin runner [#5309](https://github.com/apache/apisix/pull/5309)
+- 更正 route 的 timeout 被 service 覆盖的问题 [#5219](https://github.com/apache/apisix/pull/5219)
+- 过滤掉初始化 etcd 数据时产生的空 plugin conf [#5204](https://github.com/apache/apisix/pull/5204)
+- 健康检查特定情况下会发送错误的 Host header [#5175](https://github.com/apache/apisix/pull/5175)
+- 升级 lua-resty-balancer 到 0.04 [#5144](https://github.com/apache/apisix/pull/5144)
+- prometheus 插件修复偶发的 latency 为负数的问题 [#5150](https://github.com/apache/apisix/pull/5150)
+
 ## 2.10.0
 
 ### Change
diff --git a/docs/zh/latest/config.json b/docs/zh/latest/config.json
index 7bbb1de..fa9c34a 100644
--- a/docs/zh/latest/config.json
+++ b/docs/zh/latest/config.json
@@ -1,5 +1,5 @@
 {
-  "version": "2.10.0",
+  "version": "2.10.1",
   "sidebar": [
     {
       "type": "category",
diff --git a/docs/zh/latest/how-to-build.md b/docs/zh/latest/how-to-build.md
index de08de0..c7810d9 100644
--- a/docs/zh/latest/how-to-build.md
+++ b/docs/zh/latest/how-to-build.md
@@ -36,7 +36,7 @@ Apache APISIX 的运行环境需要依赖 NGINX 和 etcd,所以在安装 Apach
 这种安装方式适用于 CentOS 7 操作系统,请运行以下命令安装 Apache APISIX。
 
 ```shell
-sudo yum install -y https://github.com/apache/apisix/releases/download/2.10.0/apisix-2.10.0-0.el7.x86_64.rpm
+sudo yum install -y https://github.com/apache/apisix/releases/download/2.10.1/apisix-2.10.1-0.el7.x86_64.rpm
 ```
 
 ### 通过 Docker 安装
@@ -49,16 +49,16 @@ sudo yum install -y https://github.com/apache/apisix/releases/download/2.10.0/ap
 
 ### 通过源码包安装
 
-1. 创建一个名为 `apisix-2.10.0` 的目录。
+1. 创建一个名为 `apisix-2.10.1` 的目录。
 
   ```shell
-  mkdir apisix-2.10.0
+  mkdir apisix-2.10.1
   ```
 
 2. 下载 Apache APISIX Release 源码包:
 
   ```shell
-  wget https://downloads.apache.org/apisix/2.10.0/apache-apisix-2.10.0-src.tgz
+  wget https://downloads.apache.org/apisix/2.10.1/apache-apisix-2.10.1-src.tgz
   ```
 
   您也可以通过 Apache APISIX 官网下载 Apache APISIX Release 源码包。 Apache APISIX 官网也提供了 Apache APISIX、APISIX Dashboard 和 APISIX Ingress Controller 的源码包,详情请参考[Apache APISIX 官网-下载页](https://apisix.apache.org/zh/downloads)。
@@ -66,14 +66,14 @@ sudo yum install -y https://github.com/apache/apisix/releases/download/2.10.0/ap
 3. 解压 Apache APISIX Release 源码包:
 
   ```shell
-  tar zxvf apache-apisix-2.10.0-src.tgz -C apisix-2.10.0
+  tar zxvf apache-apisix-2.10.1-src.tgz -C apisix-2.10.1
   ```
 
 4. 安装运行时依赖的 Lua 库:
 
   ```shell
-  # 切换到 apisix-2.10.0 目录
-  cd apisix-2.10.0
+  # 切换到 apisix-2.10.1 目录
+  cd apisix-2.10.1
   # 创建依赖
   make deps
   ```
diff --git a/rockspec/apisix-master-0.rockspec b/rockspec/apisix-2.10.1-0.rockspec
similarity index 97%
copy from rockspec/apisix-master-0.rockspec
copy to rockspec/apisix-2.10.1-0.rockspec
index 79a0966..962770a 100644
--- a/rockspec/apisix-master-0.rockspec
+++ b/rockspec/apisix-2.10.1-0.rockspec
@@ -16,12 +16,12 @@
 --
 
 package = "apisix"
-version = "master-0"
+version = "2.10.1-0"
 supported_platforms = {"linux", "macosx"}
 
 source = {
     url = "git://github.com/apache/apisix",
-    branch = "master",
+    branch = "2.10.1",
 }
 
 description = {
@@ -36,7 +36,7 @@ dependencies = {
     "lua-resty-template = 2.0",
     "lua-resty-etcd = 1.5.4",
     "api7-lua-resty-http = 0.2.0",
-    "lua-resty-balancer = 0.02rc5",
+    "lua-resty-balancer = 0.04",
     "lua-resty-ngxvar = 0.5.2",
     "lua-resty-jit-uuid = 0.0.7",
     "lua-resty-healthcheck-api7 = 2.2.0",
diff --git a/rockspec/apisix-master-0.rockspec b/rockspec/apisix-master-0.rockspec
index 79a0966..354ebfe 100644
--- a/rockspec/apisix-master-0.rockspec
+++ b/rockspec/apisix-master-0.rockspec
@@ -36,7 +36,7 @@ dependencies = {
     "lua-resty-template = 2.0",
     "lua-resty-etcd = 1.5.4",
     "api7-lua-resty-http = 0.2.0",
-    "lua-resty-balancer = 0.02rc5",
+    "lua-resty-balancer = 0.04",
     "lua-resty-ngxvar = 0.5.2",
     "lua-resty-jit-uuid = 0.0.7",
     "lua-resty-healthcheck-api7 = 2.2.0",
diff --git a/t/cli/test_admin.sh b/t/cli/test_admin.sh
index 2ec2f7c..ac691b1 100755
--- a/t/cli/test_admin.sh
+++ b/t/cli/test_admin.sh
@@ -208,3 +208,24 @@ if ! echo "$out" | grep "Admin API can only be used with etcd config_center"; th
 fi
 
 echo "passed: Admin API can only be used with etcd config_center"
+
+# disable Admin API and init plugins syncer
+echo '
+apisix:
+  enable_admin: false
+' > conf/config.yaml
+
+rm logs/error.log
+make init
+make run
+
+make init
+
+if grep -E "failed to fetch data from etcd" logs/error.log; then
+    echo "failed: should sync /apisix/plugins from etcd when disabling admin normal"
+    exit 1
+fi
+
+make stop
+
+echo "pass: sync /apisix/plugins from etcd when disabling admin successfully"
diff --git a/t/lib/server.lua b/t/lib/server.lua
index 9f18496..d72a308 100644
--- a/t/lib/server.lua
+++ b/t/lib/server.lua
@@ -109,6 +109,7 @@ end
 
 
 function _M.status()
+    ngx.log(ngx.WARN, "client request host: ", ngx.var.http_host)
     ngx.say("ok")
 end
 
diff --git a/t/node/healthcheck2.t b/t/node/healthcheck2.t
index 1a083af..2939175 100644
--- a/t/node/healthcheck2.t
+++ b/t/node/healthcheck2.t
@@ -231,3 +231,132 @@ qr/\([^)]+\) unhealthy .* for '.*'/
 (upstream#/routes/arr_1) unhealthy TCP increment (1/2) for 'foo.com(127.0.0.1:1970)'
 (upstream#/routes/arr_1) unhealthy TCP increment (2/2) for 'foo.com(127.0.0.1:1970)'
 --- timeout: 10
+
+
+
+=== TEST 4: pass the configured host (pass_host == "pass")
+--- apisix_yaml
+routes:
+    - id: 1
+      uri: /server_port
+      upstream:
+          type: roundrobin
+          nodes:
+              "localhost:1980": 1
+              "127.0.0.1:1981": 1
+          checks:
+              active:
+                  http_path: /status
+                  healthy:
+                      interval: 1
+                      successes: 1
+                  unhealthy:
+                      interval: 1
+                      http_failures: 2
+#END
+--- config
+    location /t {
+        content_by_lua_block {
+            local http = require "resty.http"
+            local uri = "http://127.0.0.1:" .. ngx.var.server_port
+                        .. "/server_port"
+
+            do
+                local httpc = http.new()
+                local res, err = httpc:request_uri(uri, {method = "GET", keepalive = false})
+            end
+
+            ngx.sleep(1)
+        }
+    }
+--- no_error_log
+client request host: localhost
+--- error_log
+client request host: 127.0.0.1
+
+
+
+=== TEST 5: pass the configured host (pass_host == "node")
+--- apisix_yaml
+routes:
+    - id: 1
+      uri: /server_port
+      upstream:
+          type: roundrobin
+          pass_host: node
+          nodes:
+              "localhost:1980": 1
+              "127.0.0.1:1981": 1
+          checks:
+              active:
+                  http_path: /status
+                  healthy:
+                      interval: 1
+                      successes: 1
+                  unhealthy:
+                      interval: 1
+                      http_failures: 2
+#END
+--- config
+    location /t {
+        content_by_lua_block {
+            local http = require "resty.http"
+            local uri = "http://127.0.0.1:" .. ngx.var.server_port
+                        .. "/server_port"
+
+            do
+                local httpc = http.new()
+                local res, err = httpc:request_uri(uri, {method = "GET", keepalive = false})
+            end
+
+            ngx.sleep(1)
+        }
+    }
+--- error_log
+client request host: localhost
+client request host: 127.0.0.1
+
+
+
+=== TEST 6: pass the configured host (pass_host == "rewrite")
+--- apisix_yaml
+routes:
+    - id: 1
+      uri: /server_port
+      upstream:
+          type: roundrobin
+          pass_host: rewrite
+          upstream_host: foo.com
+          nodes:
+              "localhost:1980": 1
+              "127.0.0.1:1981": 1
+          checks:
+              active:
+                  http_path: /status
+                  healthy:
+                      interval: 1
+                      successes: 1
+                  unhealthy:
+                      interval: 1
+                      http_failures: 2
+#END
+--- config
+    location /t {
+        content_by_lua_block {
+            local http = require "resty.http"
+            local uri = "http://127.0.0.1:" .. ngx.var.server_port
+                        .. "/server_port"
+
+            do
+                local httpc = http.new()
+                local res, err = httpc:request_uri(uri, {method = "GET", keepalive = false})
+            end
+
+            ngx.sleep(1)
+        }
+    }
+--- no_error_log
+client request host: localhost
+client request host: 127.0.0.1
+--- error_log
+client request host: foo.com
diff --git a/t/node/priority-balancer/sanity.t b/t/node/priority-balancer/sanity.t
index b027041..2c4b1f6 100644
--- a/t/node/priority-balancer/sanity.t
+++ b/t/node/priority-balancer/sanity.t
@@ -236,7 +236,7 @@ upstreams:
     nodes:
         - host: 127.0.0.1
           port: 1979
-          weight: 2
+          weight: 1000
           priority: 1
         - host: 127.0.0.2
           port: 1979
@@ -244,7 +244,7 @@ upstreams:
           priority: 1
         - host: 127.0.0.3
           port: 1979
-          weight: 2
+          weight: 1000
           priority: -1
         - host: 127.0.0.4
           port: 1979
diff --git a/t/node/timeout-upstream.t b/t/node/timeout-upstream.t
index c860559..a7dfb8b 100644
--- a/t/node/timeout-upstream.t
+++ b/t/node/timeout-upstream.t
@@ -128,3 +128,70 @@ GET /mysleep?seconds=1
 qr/504 Gateway Time-out/
 --- error_log
 timed out) while reading response header from upstream
+
+
+
+=== TEST 5: set route inherit hosts from service
+--- config
+    location /t {
+        content_by_lua_block {
+            local t = require("lib.test_admin").test
+            local scode, sbody = t('/apisix/admin/services/1',
+                 ngx.HTTP_PUT,
+                 [[{
+                       "desc":"test-service",
+                       "hosts": ["foo.com"]
+                }]]
+                )
+
+            if scode >= 300 then
+                ngx.status = scode
+            end
+            ngx.say(sbody)
+
+            local rcode, rbody = t('/apisix/admin/routes/1',
+                 ngx.HTTP_PUT,
+                 [[{
+                        "methods": ["GET"],
+                        "service_id": "1",
+                        "upstream": {
+                            "nodes": {
+                                "127.0.0.1:1980": 1
+                            },
+                            "type": "roundrobin",
+                            "timeout": {
+                                "connect": 0.5,
+                                "send": 0.5,
+                                "read": 0.5
+                            }
+                        },
+                        "uri": "/mysleep"
+                }]]
+                )
+
+            if rcode >= 300 then
+                ngx.status = rcode
+            end
+            ngx.say(rbody)
+        }
+    }
+--- request
+GET /t
+--- response_body
+passed
+passed
+--- no_error_log
+[error]
+
+
+
+=== TEST 6: hit service route (timeout)
+--- request
+GET /mysleep?seconds=1
+--- more_headers
+Host: foo.com
+--- error_code: 504
+--- response_body eval
+qr/504 Gateway Time-out/
+--- error_log
+timed out) while reading response header from upstream
diff --git a/t/plugin/zipkin2.t b/t/plugin/zipkin2.t
index 7b0edef..9840092 100644
--- a/t/plugin/zipkin2.t
+++ b/t/plugin/zipkin2.t
@@ -31,6 +31,25 @@ add_block_preprocessor(sub {
     if (!$block->no_error_log && !$block->error_log) {
         $block->set_value("no_error_log", "[error]\n[alert]");
     }
+
+    my $extra_init_by_lua = <<_EOC_;
+    local new = require("opentracing.tracer").new
+    local tracer_mt = getmetatable(new()).__index
+    local orig_func = tracer_mt.start_span
+    tracer_mt.start_span = function (...)
+        local orig = orig_func(...)
+        local mt = getmetatable(orig).__index
+        local old_start_child_span = mt.start_child_span
+        mt.start_child_span = function(self, name, time)
+            ngx.log(ngx.WARN, "zipkin start_child_span ", name, " time: ", time)
+            return old_start_child_span(self, name, time)
+        end
+        return orig
+    end
+_EOC_
+
+    $block->set_value("extra_init_by_lua", $extra_init_by_lua);
+
 });
 
 run_tests;
@@ -83,6 +102,9 @@ x-b3-sampled: 1
 b3:
 --- error_log
 new span context: trace id: 80f198ee56343ba864fe8b2a57d3eff7, span id: e457b5a2e4d86bd1, parent span id: 05e3ac9a4f6e3b90
+--- grep_error_log eval
+qr/zipkin start_child_span apisix.response_span time: nil/
+--- grep_error_log_out
 
 
 
@@ -186,3 +208,6 @@ GET /t
 --- request
 GET /opentracing
 --- wait: 10
+--- grep_error_log eval
+qr/zipkin start_child_span apisix.response_span time: nil/
+--- grep_error_log_out