Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

非http包进入到http协议解码,不抛出BadSchema,反而bad-request进入到encodeResponse抛出空指针了 #104

Closed
dhhua opened this issue Jul 25, 2019 · 5 comments · Fixed by #110
Assignees

Comments

@dhhua
Copy link

dhhua commented Jul 25, 2019

java.lang.NullPointerException: null
at com.baidu.brpc.protocol.http.HttpRpcProtocol.encodeResponse(HttpRpcProtocol.java:410) ~[brpc-java-2.5.1.jar:na]
at com.baidu.brpc.server.handler.DecodeWorkTask.run(DecodeWorkTask.java:130) ~[brpc-java-2.5.1.jar:na]
at com.baidu.brpc.utils.ThreadPool.consume(ThreadPool.java:130) [brpc-java-2.5.1.jar:na]
at com.baidu.brpc.utils.ThreadPool.access$000(ThreadPool.java:37) [brpc-java-2.5.1.jar:na]
at com.baidu.brpc.utils.ThreadPool$1.run(ThreadPool.java:78) [brpc-java-2.5.1.jar:na]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-all-4.1.36.Final.jar:4.1.36.Final]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_05]

@dhhua
Copy link
Author

dhhua commented Jul 25, 2019

http协议不应该是
@OverRide
public boolean isCoexistence() {
return true;
}
的吧

@wenweihu86
Copy link
Collaborator

@dhhua http协议是可以和已存在的其他协议共存的,比如可用于brpc标准协议和http协议并存。
你出现的这个错误,可以给下详细的复现方法或者代码吗?

@dhhua
Copy link
Author

dhhua commented Jul 25, 2019

@wenweihu86 我是写了自定义协议,而且要和brpc协议并存,原本写的优先级比较低,接收的包在httpProtocol就报错了,还没到自定义协议解包,现在我是调高优先级解决了,建议以后可以配置要使用的protocol,现在只能配一个主协议,配了就只能用单协议了,不过就是可以用多端口解决,多端口注册服务对我这边不太好

@wenweihu86
Copy link
Collaborator

@dhhua 在httpProtocol报错了,HttpRpcProtocol.decode返回BadSchema的呀。
支持配置多个协议,确实会有这个需求,后续会支持。

@dhhua
Copy link
Author

dhhua commented Jul 25, 2019

@wenweihu86 BrpcHttpObjectDecoder在decode的时候用了HttpObjectDecoder,HttpObjectDecoder把异常直接捕获返回了bad-request了,所以不会抛出BadSchema

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants