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 2022/04/17 12:10:47 UTC

[GitHub] [apisix] tzssangglass commented on pull request #6862: fix(grpc-transcode): fetch the response body cached in the ctx

tzssangglass commented on PR #6862:
URL: https://github.com/apache/apisix/pull/6862#issuecomment-1100863421

   ## bug cause
   
   when the logger plugin is bound to global_rule and the grpc-transcode is bound to route
   
   1. in the first `body_filter` phase, run the logger plugin which is bound to global_rule first to get the response body by: https://github.com/apache/apisix/blob/605c2c40c46dcd4cd3a4d551423345faa01b1a72/apisix/utils/log-util.lua#L255
   2. then run `grpc-transcode` on route and get the response body by: https://github.com/apache/apisix/blob/605c2c40c46dcd4cd3a4d551423345faa01b1a72/apisix/plugins/grpc-transcode/response.lua#L25
   3. in the second `body_filter` phase,  run the logger plugin which is bound to global_rule, it would got `eof` is true and make `ctx._body_buffer = nil` see:https://github.com/apache/apisix/blob/605c2c40c46dcd4cd3a4d551423345faa01b1a72/apisix/core/response.lua#L180-L189
   4. in the second `body_filter` phase,  run `grpc-transcode` on route and get the response body, it would got `eof` is true, and got `ctx._body_buffer` is nil that changed by the logger plugin, the got `chunk` is an empty string.


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