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

yar协议通过http调用,demo中的motan2使用后提示超出允许内存 #1

Open
JerryChaox opened this issue Nov 30, 2017 · 9 comments

Comments

@JerryChaox
Copy link

Allowed memory size of 134217728 bytes exhausted (tried to allocate 1113678912 bytes)

@idevz
Copy link
Member

idevz commented Dec 1, 2017

请描述下你是如何使用的?比如是 PHP Client 调用 Motan2 的服务吗?还是 调用 Yar 协议的服务?

@JerryChaox
Copy link
Author

调用的是yar协议的服务
用motan2:// 提示超出允许内存
用http:// 调用提示找不到服务

motan2协议应该是php作为客户端调用了motan协议的端口,这块应该是我弄错了,接口那边没有暴露motan协议。
http协议:我用yarclient是能够请求成功的,不过遇到中文会出现解包错误,unpack error。所以想试一下这边这个组件,但是相同的url提示找不到服务

@idevz
Copy link
Member

idevz commented Dec 1, 2017

这个组件只可以调用 Motan2 协议的服务,另外你说的 http 协议的 yarclient 成功的那是 Yar 的服务端吧?是 Motan-Yar 导出的服务吗? unpack error 是调用 Motan-Yar Server 报的错?还是 PHP-Yar Server ?

@JerryChaox
Copy link
Author

php的yarclient 调用 Motan-Yar Server. 没有中文的情况下是可以正常通信的

@JerryChaox
Copy link
Author

$client = new Yar_Client("http://localhost:8003/api/merchant");
$result = $client->getMerchant(1);

@yar(“api/merchant”)
class MerchantService {
public Merchant getMerchant(int MerchantId);

暴露 demoYar:8003
public Merchant getMerchant(int merchantId) {
数据库查询
}

class Merchant {
int id;
String name; //有中文的时候出现unpack error
}

@JerryChaox
Copy link
Author

JerryChaox commented Dec 1, 2017

暴露为motan接口后提示异常:

com.weibo.api.motan.exception.MotanFrameworkException: error_message: decode error: magic error, status: 503, error_code: 20003,r=null
at com.weibo.api.motan.protocol.rpc.DefaultRpcCodec.decode(DefaultRpcCodec.java:97)
at com.weibo.api.motan.transport.netty.NettyDecoder.decode(NettyDecoder.java:165)
at com.weibo.api.motan.transport.netty.NettyDecoder.decodev2(NettyDecoder.java:116)
at com.weibo.api.motan.transport.netty.NettyDecoder.decode(NettyDecoder.java:72)
at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:282)
at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:216)
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:783)
at org.jboss.netty.channel.SimpleChannelHandler.messageReceived(SimpleChannelHandler.java:154)
at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:100)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349)
at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

@rayzhang0603
Copy link
Contributor

目前php版本只能使用motan2协议与其他语言版本通信,java端必须也使用motan2协议

@JerryChaox
Copy link
Author

motan2协议下出现以下异常:

{"errcode":10001,"errtype":1,"errmsg":"ProviderProtectedMessageRouter handler Error: provider not exist serviceKey=motan-demo-rpc/cn.tata.t2s.ssm.service.merchantService/1.0 requestId=-2620754180148297728 interface=cn.tata.t2s.ssm.service.merchantService method=getMerchant(null)"}

@idevz
Copy link
Member

idevz commented Dec 5, 2017

@JerryChaox Motan2 协议使用简单序列化来打包请求和响应,目前简单序列化只支持 3 种简单数据类型,请确认你上面 getMerchant 方法的参数是否正确?
简单序列化文档地址
相关跨语言调用实例参考motan-examples

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

No branches or pull requests

3 participants