This is an automated email from the ASF dual-hosted git repository.
nic-6443 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new f77401f1e7 fix(cli): don't capture openresty stdout in apisix start
(#14087)
f77401f1e7 is described below
commit f77401f1e7163c2d51cc2b813d8dcb0e7f827f23
Author: Nic <[email protected]>
AuthorDate: Mon Oct 26 18:03:31 2026 +0800
fix(cli): don't capture openresty stdout in apisix start (#14087)
---
apisix/cli/ops.lua | 5 ++++-
t/cli/test_access_log.sh | 31 +++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/apisix/cli/ops.lua b/apisix/cli/ops.lua
index 58428421c4..77228d8235 100644
--- a/apisix/cli/ops.lua
+++ b/apisix/cli/ops.lua
@@ -1179,7 +1179,10 @@ local function start(env, ...)
init_etcd(env, args)
end
- util.execute_cmd(env.openresty_args)
+ -- Don't capture openresty's stdout: a log file configured as /dev/stdout
+ -- would be opened on the capture pipe and kept by the daemonized workers,
+ -- so the read would never see EOF and would buffer every log line.
+ execute(env.openresty_args)
end
diff --git a/t/cli/test_access_log.sh b/t/cli/test_access_log.sh
index 180f9ff01e..4838d0a5cc 100755
--- a/t/cli/test_access_log.sh
+++ b/t/cli/test_access_log.sh
@@ -76,6 +76,37 @@ fi
make stop
+# access log to /dev/stdout: `apisix start` must not hold the log stream
+
+echo '
+nginx_config:
+ http:
+ enable_access_log: true
+ access_log: /dev/stdout
+ access_log_format: "$remote_addr - $remote_user [$time_local] $http_host
test_access_log_to_stdout"
+' > conf/config.yaml
+
+rm -f start_stdout.log
+if ! timeout 30 ./bin/apisix start > start_stdout.log; then
+ echo "failed: apisix start didn't return with access_log on /dev/stdout"
+ exit 1
+fi
+
+curl http://127.0.0.1:9080/hi
+# wait for the access log buffer to flush (flush=3)
+sleep 4
+
+if ! grep "test_access_log_to_stdout" start_stdout.log; then
+ echo "failed: access log not written to the stdout of apisix start"
+ cat start_stdout.log
+ exit 1
+fi
+
+make stop
+rm -f start_stdout.log
+
+echo "passed: apisix start returns and access log goes to its stdout"
+
echo '
nginx_config:
http: