openresty / openresty/lua-nginx-module

"expecting 3 or 4 arguments, but only seen 5" error occurs when using ngx.shared.DICT.incr api

Open
#1,700 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11.8k
Forks
2.1k
Avg merge
6h 1m
Merged PRs (30d)
6

Description

We have two test openresty environments, both versions are openresty-1.11.2.2. But when run below lua code on them, one works well and the other one goes wrong. Since their compile informations are almost the same, how could one openresty environment go wrong?

lua code block:

local expireTime = 10
local ok, err = store_dict:incr(key, 1, 0, expireTime)

The error of the one openresty environment occurs:

2020/03/05 10:22:09 [error] 494#0: *375 failed to run log_by_lua*: /wls/appsystems/MonitorMain.lua:31: expecting 3 or 4 arguments, but only seen 5
stack traceback:
        [C]: in function 'incr'
        /wls/appsystems/MonitorMain.lua:31: in function 'main'
        /wls/appsystems/log_by_lua_modules.lua:9: in function </wls/appsystems/log_by_lua_modules.lua:1> while logging request, client: 215.131.64.9, server: ng_instance, request: "POST /service/robot/

The compile information of the openresty which goes wrong:

wls81@DockerHost openresty_log]$ /wls/openresty-1.11.2.2/nginx/sbin/nginx -V
nginx version: openresty/1.11.2.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/wls/openresty-1.11.2.2/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.60 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.7 --add-module=../ngx_lua_upstream-0.06 --add-module=../headers-more-nginx-module-0.32 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.17 --add-module=../redis2-nginx-module-0.13 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.14 --add-module=../rds-csv-nginx-module-0.07 --with-ld-opt=-Wl,-rpath,/wls/openresty-1.11.2.2/luajit/lib --with-http_ssl_module --with-http_realip_module --with-http_stub_status_module --add-module=/wls/mwtools/openresty-1.11.2.2/goodies-nginx-sticky-module --add-module=/wls/mwtools/openresty-1.11.2.2/nginx_upstream_check_module-master

The compile information of the right one:

[wls81@DockerHost ~]$ /wls/openresty-1.11.2.2/nginx/sbin/nginx -V
nginx version: openresty/1.11.2.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC)
built with OpenSSL 1.0.2j  26 Sep 2016
TLS SNI support enabled
configure arguments: --prefix=/wls/openresty-1.11.2.2//nginx --with-cc-opt='-O2 -O2 -O2' --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.60 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.7 --add-module=../ngx_lua_upstream-0.06 --add-module=../headers-more-nginx-module-0.32 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.17 --add-module=../redis2-nginx-module-0.13 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.14 --add-module=../rds-csv-nginx-module-0.07 --with-ld-opt='-Wl,-rpath,/wls/openresty-1.11.2.2/luajit/lib -Wl,-rpath,/wls/openresty-1.11.2.2/luajit/lib -Wl,-rpath,/wls/openresty-1.11.2.2/luajit/lib -lrt' --add-module=/root/qiucc/openresty-1.11.2.2/bundle/nginx-goodies-nginx-sticky-module-ng --add-module=/root/qiucc/openresty-1.11.2.2/bundle/nginx_upstream_check_module-master --user=wls81 --group=wls --with-http_realip_module --with-http_ssl_module --with-http_stub_status_module --with-http_flv_module --with-http_realip_module --with-http_gunzip_module --with-http_auth_request_module --with-http_gzip_static_module --with-http_sub_module --with-stream --with-stream=dynamic --with-stream_ssl_module --with-threads --with-file-aio --with-http_v2_module --with-stream --with-stream_ssl_module --with-openssl=/root/qiucc/openssl-1.0.2j --with-pcre=/root/qiucc/pcre-8.42 --with-http_v2_module --with-stream --with-stream_ssl_module --add-dynamic-module=/root/qiucc/ngx-http-t1k-module-t1k-3.0.4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the shown store_dict:incr call and comparing both nginx -V outputs, including the ngx_lua module and linked LuaJIT build details. No source file or test is named; done means identifying the build or runtime difference that explains the argument-count error and documenting a reproducible diagnosis.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, nginx
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.