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 2020/06/01 13:13:24 UTC

[GitHub] [incubator-apisix] houshunwei opened a new issue #1637: request help: grpc-proxy request failed

houshunwei opened a new issue #1637:
URL: https://github.com/apache/incubator-apisix/issues/1637


   ### Issue description
   i followed https://github.com/apache/incubator-apisix/blob/master/doc/grpc-proxy-cn.md to config grpc.
   
   #### 1.1 SNI Config:
   ![image](https://user-images.githubusercontent.com/4208727/83402492-6d2d5500-a439-11ea-9d48-6c1c831a55bd.png)
   
   >cert and key  were made using mkcert:
   >mkcert 127.0.0.1 "127.0.0.1"
   
   #### 1.2 request error detail
   
   > grpcurl -insecure -import-path ./proto/  -proto helloworld.proto  -d '{"name":"apisix"}' 127.0.0.1:9443 helloworld.Greeter.SayHello
   
   > ERROR:
   > Code: Unavailable
   > Message: Bad Gateway: HTTP status code 502; transport: received the unexpected content-type "text/html"
   
   #### nginx log:
   > 2020/06/01 10:48:42 [warn] 36#36: *872 [lua] init.lua:176: http_ssl_phase(): failed to fetch ssl config: failed to fetch SNI: not found, context: ssl_certificate_by_lua*, client: 172.18.0.1, server: 0.0.0.0:9443
   > 2020/06/01 10:48:42 [error] 36#36: *871 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: , request: "POST /helloworld.Greeter/SayHello HTTP/2.0", upstream: "grpc://127.0.0.1:50051", host: "127.0.0.1:9443"
   > 2020/06/01 10:48:42 [error] 36#36: *871 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: , request: "POST /helloworld.Greeter/SayHello HTTP/2.0", upstream: "grpc://127.0.0.1:50051", host: "127.0.0.1:9443"
   
   #### 1.3 request directly:
   > grpcurl -plaintext -import-path ./proto/  -proto helloworld.proto  -d '{"name":"apisix"}' 127.0.0.1:50051 helloworld.Greeter.SayHello
   
   result:
   >{
   >  "message": "Hello apisix"
   > }
   
   
   
   ### Environment
   
   * apisix version (cmd: `apisix version`): 1.2
   * OS: docker, centos
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-apisix] houshunwei closed issue #1637: request help: grpc-proxy request failed

Posted by GitBox <gi...@apache.org>.
houshunwei closed issue #1637:
URL: https://github.com/apache/incubator-apisix/issues/1637


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-apisix] houshunwei edited a comment on issue #1637: request help: grpc-proxy request failed

Posted by GitBox <gi...@apache.org>.
houshunwei edited a comment on issue #1637:
URL: https://github.com/apache/incubator-apisix/issues/1637#issuecomment-637900172


   I got the reason. Silly me.
   For whom using apisix in docker, when config routes or upstream, should notice that: 
   > Inside docker container, 127.0.0.1 is container's ip. 
   > If you want to upstream to host machine, don't use 127.0.0.1.
   
   ![image](https://user-images.githubusercontent.com/4208727/83585545-b1753e00-a57c-11ea-880b-c0781d73140d.png)
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-apisix] houshunwei edited a comment on issue #1637: request help: grpc-proxy request failed

Posted by GitBox <gi...@apache.org>.
houshunwei edited a comment on issue #1637:
URL: https://github.com/apache/incubator-apisix/issues/1637#issuecomment-637243002


   I guess sni config is not work. 
   I have restarted apisix by:
   'docker-compose -p docker-apisix restart'
   
   but i don't know how to check. Does anyone give me a hint?
   Or: is it possible to config apisix so that let grpc-proxy use http/s without ssl?
    
   
   
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-apisix] houshunwei commented on issue #1637: request help: grpc-proxy request failed

Posted by GitBox <gi...@apache.org>.
houshunwei commented on issue #1637:
URL: https://github.com/apache/incubator-apisix/issues/1637#issuecomment-637900172


   I got the reason. Silly me.
   For whom using apisix in docker, when config routes or upstream, should notice that: 
   > Inside docker container, 127.0.0.1 is container's ip. 
   > If you wan to upstream to host machine, don't use 127.0.0.1.
   
   ![image](https://user-images.githubusercontent.com/4208727/83585545-b1753e00-a57c-11ea-880b-c0781d73140d.png)
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-apisix] houshunwei edited a comment on issue #1637: request help: grpc-proxy request failed

Posted by GitBox <gi...@apache.org>.
houshunwei edited a comment on issue #1637:
URL: https://github.com/apache/incubator-apisix/issues/1637#issuecomment-637243002


   I guess sni config is not work. 
   I have restarted apisix by:
   'docker-compose -p docker-apisix restart'
   
   but i don't know how to check. Does anyone give me a hint?
   Or: is it possible to config apisix so that let grpc-proxy use http/2 without ssl?
    
   
   
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-apisix] houshunwei commented on issue #1637: request help: grpc-proxy request failed

Posted by GitBox <gi...@apache.org>.
houshunwei commented on issue #1637:
URL: https://github.com/apache/incubator-apisix/issues/1637#issuecomment-637636818


   I opened the debug mode, and got following detail error:
   It seems that sni problem is fine. balancer cannot connect to upstream.
   ```java
   2020/06/02 15:38:38 [warn] 36#36: *4135 [lua] init.lua:176: http_ssl_phase(): failed to fetch ssl config: failed to fetch SNI: not found, context: ssl_certificate_by_lua*, client: 172.18.0.1, server: 0.0.0.0:9443
   2020/06/02 15:38:38 [debug] 36#36: *4134 [lua] debug.lua:128: http_access_phase(): call require("apisix").http_access_phase() args:{}
   2020/06/02 15:38:38 [info] 36#36: *4134 [lua] init.lua:287: fun_org(): matched route: {"value":{"priority":0,"methods":["POST","GET"],"uri":"\/helloworld.Greeter\/SayHello","id":"1","service_protocol":"grpc","upstream":{"hash_on":"vars","nodes":{"127.0.0.1:50051":1},"type":"roundrobin"}},"clean_handlers":{},"createdIndex":31,"has_domain":false,"key":"\/apisix\/routes\/1","modifiedIndex":31}, client: 172.18.0.1, server: , request: "POST /helloworld.Greeter/SayHello HTTP/2.0", host: "127.0.0.1:9443"
   2020/06/02 15:38:38 [info] 36#36: *4134 [lua] init.lua:399: grpc_access_phase(): route: {"value":{"priority":0,"methods":["POST","GET"],"uri":"\/helloworld.Greeter\/SayHello","id":"1","service_protocol":"grpc","upstream":{"hash_on":"vars","nodes":{"127.0.0.1:50051":1},"type":"roundrobin"}},"clean_handlers":{},"createdIndex":31,"has_domain":false,"key":"\/apisix\/routes\/1","modifiedIndex":31}, client: 172.18.0.1, server: , request: "POST /helloworld.Greeter/SayHello HTTP/2.0", host: "127.0.0.1:9443"
   2020/06/02 15:38:38 [info] 36#36: *4134 [lua] balancer.lua:198: pick_server(): route: {"value":{"priority":0,"methods":["POST","GET"],"uri":"\/helloworld.Greeter\/SayHello","id":"1","service_protocol":"grpc","upstream":{"hash_on":"vars","nodes":{"127.0.0.1:50051":1},"type":"roundrobin"}},"clean_handlers":{},"createdIndex":31,"has_domain":false,"key":"\/apisix\/routes\/1","modifiedIndex":31} while connecting to upstream, client: 172.18.0.1, server: , request: "POST /helloworld.Greeter/SayHello HTTP/2.0", host: "127.0.0.1:9443"
   2020/06/02 15:38:38 [info] 36#36: *4134 [lua] balancer.lua:199: pick_server(): ctx: {"conf_id":"1","conf_type":"route","conf_version":31,"plugins":{},"balancer_name":"default","matched_route":{"value":{"priority":0,"methods":["POST","GET"],"uri":"\/helloworld.Greeter\/SayHello","id":"1","service_protocol":"grpc","upstream":{"hash_on":"vars","nodes":{"127.0.0.1:50051":1},"type":"roundrobin"}},"clean_handlers":{},"createdIndex":31,"has_domain":false,"key":"\/apisix\/routes\/1","modifiedIndex":31},"var":{"host":"127.0.0.1","request_method":"POST","uri":"\/helloworld.Greeter\/SayHello","remote_addr":"172.18.0.1","_request":"cdata<void *>: 0x026b6d30"}} while connecting to upstream, client: 172.18.0.1, server: , request: "POST /helloworld.Greeter/SayHello HTTP/2.0", host: "127.0.0.1:9443"
   2020/06/02 15:38:38 [error] 36#36: *4134 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: , request: "POST /helloworld.Greeter/SayHello HTTP/2.0", upstream: "grpc://127.0.0.1:50051", host: "127.0.0.1:9443"
   2020/06/02 15:38:38 [info] 36#36: *4134 [lua] balancer.lua:198: pick_server(): route: {"value":{"priority":0,"methods":["POST","GET"],"uri":"\/helloworld.Greeter\/SayHello","id":"1","service_protocol":"grpc","upstream":{"hash_on":"vars","nodes":{"127.0.0.1:50051":1},"type":"roundrobin"}},"clean_handlers":{},"createdIndex":31,"has_domain":false,"key":"\/apisix\/routes\/1","modifiedIndex":31} while connecting to upstream, client: 172.18.0.1, server: , request: "POST /helloworld.Greeter/SayHello HTTP/2.0", upstream: "grpc://127.0.0.1:50051", host: "127.0.0.1:9443"
   2020/06/02 15:38:38 [info] 36#36: *4134 [lua] balancer.lua:199: pick_server(): ctx: {"conf_id":"1","var":{"host":"127.0.0.1","request_method":"POST","uri":"\/helloworld.Greeter\/SayHello","remote_addr":"172.18.0.1","_request":"cdata<void *>: 0x026b6d30"},"balancer_name":"default","balancer_ip":"127.0.0.1","balancer_port":50051,"conf_type":"route","conf_version":31,"plugins":{},"proxy_passed":true,"matched_route":{"value":{"priority":0,"methods":["POST","GET"],"uri":"\/helloworld.Greeter\/SayHello","id":"1","service_protocol":"grpc","upstream":{"hash_on":"vars","nodes":{"127.0.0.1:50051":1},"type":"roundrobin"}},"clean_handlers":{},"createdIndex":31,"has_domain":false,"key":"\/apisix\/routes\/1","modifiedIndex":31},"balancer_try_count":1} while connecting to upstream, client: 172.18.0.1, server: , request: "POST /helloworld.Greeter/SayHello HTTP/2.0", upstream: "grpc://127.0.0.1:50051", host: "127.0.0.1:9443"
   2020/06/02 15:38:38 [error] 36#36: *4134 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: , request: "POST /helloworld.Greeter/SayHello HTTP/2.0", upstream: "grpc://127.0.0.1:50051", host: "127.0.0.1:9443"
   2020/06/02 15:38:38 [debug] 36#36: *4134 [lua] debug.lua:128: http_header_filter_phase(): call require("apisix").http_header_filter_phase() args:{}
   2020/06/02 15:38:38 [debug] 36#36: *4134 [lua] debug.lua:134: http_header_filter_phase(): call require("apisix").http_header_filter_phase() return:{}
   2020/06/02 15:38:38 [debug] 36#36: *4134 [lua] debug.lua:128: http_body_filter_phase(): call require("apisix").http_body_filter_phase() args:{}
   2020/06/02 15:38:38 [debug] 36#36: *4134 [lua] debug.lua:134: http_body_filter_phase(): call require("apisix").http_body_filter_phase() return:{}
   2020/06/02 15:38:38 [debug] 36#36: *4134 [lua] debug.lua:128: http_log_phase(): call require("apisix").http_log_phase() args:{}
   2020/06/02 15:38:38 [debug] 36#36: *4134 [lua] debug.lua:134: http_log_phase(): call require("apisix").http_log_phase() return:{}
   ```


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-apisix] houshunwei edited a comment on issue #1637: request help: grpc-proxy request failed

Posted by GitBox <gi...@apache.org>.
houshunwei edited a comment on issue #1637:
URL: https://github.com/apache/incubator-apisix/issues/1637#issuecomment-637243002


   I guess sni config is not work. 
   I have restart by:
   'docker-compose -p docker-apisix restart'
   
   but i don't know how to check. Does anyone give me a hint?
   Or: is it possible to config apisix so that let grpc-proxy use http/s without ssl?
    
   
   
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-apisix] houshunwei commented on issue #1637: request help: grpc-proxy request failed

Posted by GitBox <gi...@apache.org>.
houshunwei commented on issue #1637:
URL: https://github.com/apache/incubator-apisix/issues/1637#issuecomment-637243002


   I guess sni config is not work. 
   I have restart by:
   docker-compose -p docker-apisix restart
   ------
   but i don't know how to check. Does anyone give me a hint?
   Or: is it possible to config apisix so that let grpc-proxy use http/s without ssl?
    
   
   
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-apisix] houshunwei commented on issue #1637: request help: grpc-proxy request failed

Posted by GitBox <gi...@apache.org>.
houshunwei commented on issue #1637:
URL: https://github.com/apache/incubator-apisix/issues/1637#issuecomment-637465944


   I check the lua code, it has problem here: radixtree_sni.lua
   sni, err = ngx_ssl.server_name()
   sni is nil.
   
   @membphis   is this a radixtree_sni.lua bug?
   if not, ngx_ssl should read which part of crt to get server_name?  can u help me to get through it?


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-apisix] houshunwei commented on issue #1637: request help: grpc-proxy request failed

Posted by GitBox <gi...@apache.org>.
houshunwei commented on issue #1637:
URL: https://github.com/apache/incubator-apisix/issues/1637#issuecomment-637348487


   I upgraded to apisix 1.3, and got the same error.


----------------------------------------------------------------
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:
users@infra.apache.org