spacewander commented on issue #3193:
URL: https://github.com/apache/apisix/issues/3193#issuecomment-755023037


   There is no code to delete `api_ctx` in APISIX. I guess it is because the 
client closed the request before we assign an `api_ctx`. Would you apply the 
patch to check if the `api_ctx` is assigned?
   ```diff
   diff --git apisix/init.lua apisix/init.lua
   index de51cd38..65585aec 100644
   --- apisix/init.lua
   +++ apisix/init.lua
   @@ -327,6 +327,7 @@ function _M.http_access_phase()
   
        if not api_ctx then
            api_ctx = core.tablepool.fetch("api_ctx", 0, 32)
   +        core.log.alert("set api_ctx ", tostring(ngx_ctx))
            ngx_ctx.api_ctx = api_ctx
        end
   
   @@ -586,6 +587,7 @@ end
    local function common_phase(phase_name)
        local api_ctx = ngx.ctx.api_ctx
        if not api_ctx then
   +        core.log.alert("can't find api_ctx ", tostring(ngx.ctx))
            return
        end
   ```
   
   BTW, is this problem only happened in subrequest?


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to