You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2020/03/21 01:56:51 UTC

[GitHub] [incubator-brpc] GOGOYAO opened a new issue #1069: Cannot assign requested address

GOGOYAO opened a new issue #1069: Cannot assign requested address
URL: https://github.com/apache/incubator-brpc/issues/1069
 
 
   **Describe the bug (描述bug)**
   W0321 09:41:31.386391 44601 /tmp/incubator-brpc/src/brpc/socket.cpp:1134] Fail to connect to 172.17.0.3:44444: Cannot assign requested address
   
   **To Reproduce (复现方法)**
   brpc::Channel放在栈空间,也就是说每次请求server的时候,都会构造/析构。当rpc发送一段时间后,就会出这个错误。是因为不断地构造/析构导致的吗
   
   **Expected behavior (期望行为)**
   正常请求
   
   **Versions (各种版本)**
   OS: centos 7.7
   Compiler: gcc 8
   brpc: master最新分支
   protobuf: 3.11
   
   **Additional context/screenshots (更多上下文/截图)**
   
   

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] GOGOYAO commented on issue #1069: Cannot assign requested address

Posted by GitBox <gi...@apache.org>.
GOGOYAO commented on issue #1069: Cannot assign requested address
URL: https://github.com/apache/incubator-brpc/issues/1069#issuecomment-602002043
 
 
   > 选项`-reuse_addr`没有设置为false吧
   
   对的。都是用的默认的选项。这里reuse_addr和reuse_port推荐是怎么设置呢?

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] GOGOYAO commented on issue #1069: Cannot assign requested address

Posted by GitBox <gi...@apache.org>.
GOGOYAO commented on issue #1069: Cannot assign requested address
URL: https://github.com/apache/incubator-brpc/issues/1069#issuecomment-602141011
 
 
   > 选项`-reuse_addr`没有设置为false吧
   
   戈神,话说我使用的是单链接,场景也是一个client和一个server,reuse_addr不管设置什么值,也不该出现这个情况吧。我理解都是在复用一个连接。
   还是没太懂reuse_addr设为false的用意,求解答下,感谢

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] GOGOYAO commented on issue #1069: Cannot assign requested address

Posted by GitBox <gi...@apache.org>.
GOGOYAO commented on issue #1069:
URL: https://github.com/apache/incubator-brpc/issues/1069#issuecomment-618891035


   > 回到你这个case,你是在向本机一直发请求吗? QPS有多少?
   
   是向本地发的。qps没注意,就是起了几个线程while循环一直在发。
   
   你说的有道理,不过我一直理解成  单链接哪怕在channel实例析构后,还会存活一会,以便复用。。话说这样岂不是更好么?复用率更高


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] jamesge commented on issue #1069: Cannot assign requested address

Posted by GitBox <gi...@apache.org>.
jamesge commented on issue #1069: Cannot assign requested address
URL: https://github.com/apache/incubator-brpc/issues/1069#issuecomment-601995013
 
 
   选项`-reuse_addr`没有设置为false吧

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] gydong commented on issue #1069: Cannot assign requested address

Posted by GitBox <gi...@apache.org>.
gydong commented on issue #1069:
URL: https://github.com/apache/incubator-brpc/issues/1069#issuecomment-619467152


   实例析构,而它背后的某些资源还存在,这其实有悖于RAII理念的设计。如果是换做连接池模式,你说的是可以的。我觉着就是用应用层面去复用实例就好,仔细想想,这种事情如果放到框架在背后偷偷做,可能你会更反对。


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] GOGOYAO commented on issue #1069: Cannot assign requested address

Posted by GitBox <gi...@apache.org>.
GOGOYAO commented on issue #1069:
URL: https://github.com/apache/incubator-brpc/issues/1069#issuecomment-618780615


   > 是的
   
   尴尬,文档里面还说的 “Channel可以分配在栈上。”  这句话该咋理解呢?这句话不是连接可以复用?
   


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] gydong commented on issue #1069: Cannot assign requested address

Posted by GitBox <gi...@apache.org>.
gydong commented on issue #1069:
URL: https://github.com/apache/incubator-brpc/issues/1069#issuecomment-618799067


   是可以放到栈上。但地址也是一种资源,就像内存一样,更多的要靠应用去选择合适的方式来避免资源耗尽,框架层面主要负责提供丰富的、灵活的接口,解决共性问题、满足共性需求。  
   回到你这个case,你是在向本机一直发请求吗? QPS有多少?


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] gydong commented on issue #1069: Cannot assign requested address

Posted by GitBox <gi...@apache.org>.
gydong commented on issue #1069:
URL: https://github.com/apache/incubator-brpc/issues/1069#issuecomment-618771882


   是的


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] chenzhangyi commented on issue #1069: Cannot assign requested address

Posted by GitBox <gi...@apache.org>.
chenzhangyi commented on issue #1069:
URL: https://github.com/apache/incubator-brpc/issues/1069#issuecomment-619495220


   可以设置[-defer_close_second](https://github.com/apache/incubator-brpc/blob/2f8fc37d52c2a02ee6f348aaa52c7ded4a4844c3/src/brpc/socket_map.cpp#L43). 这个是用来解决这类问题的


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] GOGOYAO commented on issue #1069: Cannot assign requested address

Posted by GitBox <gi...@apache.org>.
GOGOYAO commented on issue #1069:
URL: https://github.com/apache/incubator-brpc/issues/1069#issuecomment-619493775


   > 实例析构,而它背后的某些资源还存在,这其实有悖于RAII理念的设计。如果是换做连接池模式,你说的是可以的。我觉着就是用应用层面去复用实例就好,仔细想想,这种事情如果放到框架在背后偷偷做,可能你会更反对。
   
   恩恩。感谢解答


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] GOGOYAO commented on issue #1069: Cannot assign requested address

Posted by GitBox <gi...@apache.org>.
GOGOYAO commented on issue #1069:
URL: https://github.com/apache/incubator-brpc/issues/1069#issuecomment-618405069


   > 1、尽管是单连接,但实例析构之后,连接不会得到复用,而是会重复建立连接。(这一点用ss命令查看确认一下即可)
   
   实例析构是指得channel实例析构么?


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] gydong commented on issue #1069: Cannot assign requested address

Posted by GitBox <gi...@apache.org>.
gydong commented on issue #1069:
URL: https://github.com/apache/incubator-brpc/issues/1069#issuecomment-616898361


   1、尽管是单连接,但实例析构之后,连接不会得到复用,而是会重复建立连接。(这一点用ss命令查看确认一下即可)  
   2、reuse_addr 保持默认的true即可,但这个选项和你遇到的问题关系应该不大,怎么设置都解决不了你遇到的问题。原因是从brpc的实现来看,reuse_addr这个开关只对server端的listen动作管用,对于client端的connect动作是没有任何作用的。  
   综上,要解决你的问题,应该让channel实例得到复用。


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org