wklken commented on issue #9951:
URL: https://github.com/apache/apisix/issues/9951#issuecomment-1663203495

   after register the route+service, got 404
   
   > curl 'http://127.0.0.1:9180/apisix/admin/services/eee.prod.stage-20'  -H 
'X-API-KEY: eex3P86cLLSlAOagO1em3FADrRXhMR2c' | jq
   
   ```
   {
     "key": "/bk-gateway-apisix/services/eee.prod.stage-20",
     "modifiedIndex": 437855,
     "value": {
       "labels": {
         "gateway.bk.tencent.com/stage": "prod",
         "gateway.bk.tencent.com/gateway": "eee"
       },
       "update_time": 1691028294,
   ```
   
   the modifiedIndex is `437855`
   
   and the log,  `/watch` start_revisions is `437868`, so at that time, the 
apisix has no newest configdata, and will never know the changes until 
reload/restart
   
   ```
   2023/08/03 02:10:04 [info] 37#37: *19 [lua] v3.lua:852: request_chunk(): 
http request method: POST path: /watch body: 
{"create_request":{"range_end":"L2JrLWdhdGV3YXktYXBpc2l4MA==","key":"L2JrLWdhdGV3YXktYXBpc2l4Lw==","start_revision":437868}}
 query: nil, context: ngx.timer
   2023/08/03 02:10:04 [info] 37#37: *19 [lua] config_etcd.lua:193: res_func: {
     result = {
       created = true,
       header = {
         cluster_id = "3892788201713343575",
         member_id = "12985827509394625062",
         raft_term = "57",
         revision = "437868"
       }
     }
   }, context: ngx.timer
   ```
   
   and I add another route+service, 404; 
   
   
   ```
   2023/08/03 02:22:05 [info] 40#40: *40 [lua] config_etcd.lua:193: res_func: 
nil, context: ngx.timer
   2023/08/03 02:22:05 [info] 40#40: *40 [lua] config_etcd.lua:107: 
cancel_watch(): cancel watch connection success, context: ngx.timer
   2023/08/03 02:22:05 [info] 40#40: *40 [lua] config_etcd.lua:181: restart 
watchdir: start_revision=437886, context: ngx.timer
   2023/08/03 02:22:05 [info] 37#37: *28877 epoll_wait() reported that client 
prematurely closed connection, so upstream connection is closed too while 
reading upstream, client: unix:, server: , request: "POST /v3/watch HTTP/1.1", 
upstream: "http://1.1.1.1:2379/v3/watch";, host: "127.0.0.1"
   2023/08/03 02:22:05 [info] 40#40: *40 [lua] v3.lua:76: choose_endpoint(): 
choose endpoint: http://127.0.0.1:2379, context: ngx.timer
   2023/08/03 02:22:05 [info] 37#37: *19 [lua] config_etcd.lua:193: res_func: 
nil, context: ngx.timer
   2023/08/03 02:22:05 [info] 37#37: *19 [lua] config_etcd.lua:107: 
cancel_watch(): cancel watch connection success, context: ngx.timer
   2023/08/03 02:22:05 [info] 37#37: *19 [lua] config_etcd.lua:181: restart 
watchdir: start_revision=437886, context: ngx.timer
   2023/08/03 02:22:05 [info] 37#37: *19 [lua] v3.lua:76: choose_endpoint(): 
choose endpoint: http://127.0.0.1:2379, context: ngx.timer
   2023/08/03 02:22:05 [info] 37#37: *29656 [lua] client.lua:123: dns_parse(): 
dns resolve bk-apigateway-etcd, result: 
{"class":1,"address":"1.1.1.1","section":1,"name":"bk-apigateway-etcd.default.svc.cluster.local","ttl":30,"type":1},
 client: unix:, server: , request: "POST /v3/watch HTTP/1.1", host: "127.0.0.1"
   2023/08/03 02:22:05 [info] 37#37: *29656 [lua] resolver.lua:84: 
parse_domain(): parse addr: 
{"class":1,"section":1,"address":"1.1.1.1","name":"bk-apigateway-etcd.default.svc.cluster.local","ttl":30,"type":1},
 client: unix:, server: , request: "POST /v3/watch HTTP/1.1", host: "127.0.0.1"
   2023/08/03 02:22:05 [info] 37#37: *29656 [lua] resolver.lua:85: 
parse_domain(): resolver: ["10.96.0.10"], client: unix:, server: , request: 
"POST /v3/watch HTTP/1.1", host: "127.0.0.1"
   2023/08/03 02:22:05 [info] 37#37: *29656 [lua] resolver.lua:86: 
parse_domain(): host: bk-apigateway-etcd, client: unix:, server: , request: 
"POST /v3/watch HTTP/1.1", host: "127.0.0.1"
   2023/08/03 02:22:05 [info] 37#37: *29656 [lua] resolver.lua:88: 
parse_domain(): dns resolver domain: bk-apigateway-etcd to 1.1.1.1, client: 
unix:, server: , request: "POST /v3/watch HTTP/1.1", host: "127.0.0.1"
   2023/08/03 02:22:05 [info] 37#37: *29589 epoll_wait() reported that client 
prematurely closed connection, so upstream connection is closed too while 
reading upstream, client: unix:, server: , request: "POST /v3/watch HTTP/1.1", 
upstream: "http://1.1.1.1:2379/v3/watch";, host: "127.0.0.1"
   2023/08/03 02:22:05 [info] 37#37: *30892 [lua] client.lua:123: dns_parse(): 
dns resolve bk-apigateway-etcd, result: 
{"class":1,"address":"1.1.1.1","section":1,"name":"bk-apigateway-etcd.default.svc.cluster.local","ttl":30,"type":1},
 client: unix:, server: , request: "POST /v3/watch HTTP/1.1", host: "127.0.0.1"
   2023/08/03 02:22:05 [info] 37#37: *30892 [lua] resolver.lua:84: 
parse_domain(): parse addr: 
{"class":1,"section":1,"address":"1.1.1.1","name":"bk-apigateway-etcd.default.svc.cluster.local","ttl":30,"type":1},
 client: unix:, server: , request: "POST /v3/watch HTTP/1.1", host: "127.0.0.1"
   2023/08/03 02:22:05 [info] 37#37: *30892 [lua] resolver.lua:85: 
parse_domain(): resolver: ["10.96.0.10"], client: unix:, server: , request: 
"POST /v3/watch HTTP/1.1", host: "127.0.0.1"
   2023/08/03 02:22:05 [info] 37#37: *30892 [lua] resolver.lua:86: 
parse_domain(): host: bk-apigateway-etcd, client: unix:, server: , request: 
"POST /v3/watch HTTP/1.1", host: "127.0.0.1"
   2023/08/03 02:22:05 [info] 37#37: *30892 [lua] resolver.lua:88: 
parse_domain(): dns resolver domain: bk-apigateway-etcd to 1.1.1.1, client: 
unix:, server: , request: "POST /v3/watch HTTP/1.1", host: "127.0.0.1"
   2023/08/03 02:22:05 [info] 40#40: *40 [lua] v3.lua:852: request_chunk(): 
http request method: POST path: /watch body: 
{"create_request":{"range_end":"L2JrLWdhdGV3YXktYXBpc2l4MA==","key":"L2JrLWdhdGV3YXktYXBpc2l4Lw==","start_revision":437886}}
 query: nil, context: ngx.timer
   2023/08/03 02:22:05 [info] 37#37: *19 [lua] v3.lua:852: request_chunk(): 
http request method: POST path: /watch body: 
{"create_request":{"range_end":"L2JrLWdhdGV3YXktYXBpc2l4MA==","key":"L2JrLWdhdGV3YXktYXBpc2l4Lw==","start_revision":437886}}
 query: nil, context: ngx.timer
   2023/08/03 02:22:05 [info] 40#40: *40 [lua] config_etcd.lua:193: res_func: {
     result = {
       created = true,
       header = {
         cluster_id = "3892788201713343575",
         member_id = "12985827509394625062",
         raft_term = "57",
         revision = "437886"
       }
     }
   }, context: ngx.timer
   
   ```
   
   ----
   
   How the apisix know the `start_reversion` after it cancel and start a new 
connection? 
   
   
   
   


-- 
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-unsubscr...@apisix.apache.org

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

Reply via email to