You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/10/27 07:03:15 UTC

[GitHub] [apisix] johndudo opened a new issue #5341: bug: The concurrent access to the admin api "/apisix/admin/upstreams" will fail

johndudo opened a new issue #5341:
URL: https://github.com/apache/apisix/issues/5341


   ### Issue description
   
   version:  2.10.0
   refer:     Admin APIļ¼š/apisix/admin/upstreams
   issue:  
   The concurrent access to the admin api "/apisix/admin/upstreams" will fail.
   access log:
   
   2021/10/27 05:57:11 [error] 48#48: *156358695 [lua] upstreams.lua:222: failed to set new upstream[/upstreams/upstream-h5-web]: value changed before overwritten, client: 10.42.2.0, server: , request: "PATCH /apisix/admin/upstreams/upstream-h5-web HTTP/1.1", host: "apisix-admin.sit.yk.com" 
   10.42.2.0 - - [27/Oct/2021:05:57:10 +0000] apisix-admin.sit.yk.com "PATCH /apisix/admin/upstreams/upstream-h5-web HTTP/1.1" 201 464 0.015 "-" "Apache-HttpClient/4.5.8 (Java/1.8.0_45)" - - - "http://apisix-admin.sit.yk.com" 
   10.42.2.0 - - [27/Oct/2021:05:57:11 +0000] apisix-admin.sit.yk.com "PATCH /apisix/admin/upstreams/upstream-h5-web HTTP/1.1" 503 60 0.015 "-" "Apache-HttpClient/4.5.8 (Java/1.8.0_45)" - - - "http://apisix-admin.sit.yk.com" 
   
   ### Environment
   
   - apisix version (cmd: `apisix version`): 2.10.0
   
   - OS (cmd: `uname -a`):  Linux apisix-7587cbcdbc-q2dps 4.18.0-240.el8.x86_64 #1 SMP Fri Sep 25 19:48:47 UTC 2020 x86_64 Linux
   
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   nginx version: openresty/1.19.3.1
   built by gcc 10.2.1 20201203 (Alpine 10.2.1_pre1) 
   built with OpenSSL 1.1.1k  25 Mar 2021
   TLS SNI support enabled
   configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl/include' --add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.19 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.15 --add-module=../rds-csv-nginx-module-0.09 --add-module=../ngx_stream_lua-0.0.9 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/pcre/l
 ib -L/usr/local/openresty/openssl/lib -Wl,-rpath,/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl/lib' --with-pcre --with-compat --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-ipv6 --with-mail --with-mail_ssl_module --with-md5-asm --with-pcre-jit --with-sha1-asm --with-stream --with-stream_ssl_module --with-threads --with-stream --with-stream_ssl_preread_module
   
   
   
   ### Steps to reproduce
   
   1.concurrent access to the admin api "/apisix/admin/upstreams/upstream-h5-web" 
   
   ### Actual result
   
   failed to set new upstream[/upstreams/upstream-h5-web]: value changed before overwritten
   
   ### Error log
   
   2021/10/27 05:57:11 [error] 48#48: *156358695 [lua] upstreams.lua:222: failed to set new upstream[/upstreams/upstream-h5-web]: value changed before overwritten, client: 10.42.2.0, server: , request: "PATCH /apisix/admin/upstreams/upstream-h5-web HTTP/1.1", host: "apisix-admin.sit.yk.com" 
   10.42.2.0 - - [27/Oct/2021:05:57:10 +0000] apisix-admin.sit.yk.com "PATCH /apisix/admin/upstreams/upstream-h5-web HTTP/1.1" 201 464 0.015 "-" "Apache-HttpClient/4.5.8 (Java/1.8.0_45)" - - - "http://apisix-admin.sit.yk.com" 
   10.42.2.0 - - [27/Oct/2021:05:57:11 +0000] apisix-admin.sit.yk.com "PATCH /apisix/admin/upstreams/upstream-h5-web HTTP/1.1" 503 60 0.015 "-" "Apache-HttpClient/4.5.8 (Java/1.8.0_45)" - - - "http://apisix-admin.sit.yk.com" 
   
   ### Expected result
   
   when concurrent access to the admin api "/apisix/admin/upstreams/upstream-h5-web" , error should not occur.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tokers commented on issue #5341: bug: concurrent access to the admin api "/apisix/admin/upstreams" will fail

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #5341:
URL: https://github.com/apache/apisix/issues/5341#issuecomment-952713891


   This is an expected behavior, since all write operations are implemented by the "compare and swap" mechanism, so if the object was changed before the current operation submitted, the operation will be aborted.
   
   We don't have a retry in the Admin API, so now the solution will be jitter your client calls so that they won't be launched simultaneously.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tokers edited a comment on issue #5341: bug: concurrent access to the admin api "/apisix/admin/upstreams" will fail

Posted by GitBox <gi...@apache.org>.
tokers edited a comment on issue #5341:
URL: https://github.com/apache/apisix/issues/5341#issuecomment-952713891






-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org